Running Python package unit tests in PyCharm -
i 'ported' python package i'm writing pycharm , having bit of trouble running unit tests whole package ide.
in __init__.py
package have load_tests
function goes on modules in package , loads relevant tests. runs splendidly with:
$python -m unittest my_package
however, when try running pycharm (by selecting top directory in projects window , hitting ctrl+shift+f10) no tests found
in run window, and
...\python.exe ...\pycharm\utrunner.py .../my_package/ true testing started @ ... process finished exit code 0 empty test suite.
in console window.
i took quick @ pycharm's utrunner.py
, seems looking modules pattern (that start test). preserve present vanilla approach. how can configure pycharm use load_tests
__init__.py
while modifying code little possible?
by way, test suites individual modules run fine pycharm.
using pycharm 3.1 community edition, python 2.7.
thank in advance.
this answer has been written considering pycharm 3.4.
had same problem, found solution problem in answer, hope understood question right:
https://stackoverflow.com/a/12242021/2427749
i configured python test runner configuration this:
- checked 'all in folder'
- pattern regular expression '.*_test.py' (without quotes)
- checked 'inspect subclass unittest.testcase'.
now finds unitests in subfolders named classtobetested_test.py
by way, i'm facing problem now: unit test cannot import module tested. cause of different root folder think.
Comments
Post a Comment