I just 'ported' a Python package I'm writing to PyCharm and having a bit of trouble running unit tests for the whole package from the IDE.
In __init__.py
for the package I have load_tests
function that goes over all modules in the package and loads relevant tests. It runs splendidly with:
$python -m unittest my_package
However, when I try running it from PyCharm (by selecting the top directory in the Projects window and hitting Ctrl+Shift+F10) I get No tests were found
in the Run window, and
...\python.exe ...\pycharm\utrunner.py .../my_package/ true
Testing started at ...
Process finished with exit code 0
Empty test suite.
in the console window.
I took a quick look at PyCharm's utrunner.py
and it seems that it is looking for modules with a certain pattern (that start with test). I would like to preserve the present vanilla approach. How can I configure PyCharm to use load_tests
from __init__.py
while modifying the code as little as possible?
By the way, test suites for individual modules run just fine from PyCharm.
Using PyCharm 3.1 Community Edition, Python 2.7.