I have the following structure in a project:
app/
__init__.py
main.py
tests/
__init__.py
test_a.py
test_b.py
I would like to initialize logging for tests under the tests
package. I placed the initialization code in app/tests/__init__.py
under the assumption that it is run before any test is run, however I've discovered this is not the case.
How can I make this initialization code run in the following scenarios?
- When running
python test_a.py
from the command prompt - When running
test_a.py
as a unit-test under eclipse\aptana\pycharm - When running the entire test suite under eclipse\aptana\pycharm