python -m unittest specifying tests and/or modules instead of discover -


i attempting run subset of tests part of build; i've been unable run individual tests python3 -m unittest <test>

i have tried follow docs , read through: running unittest typical test directory structure still having no luck

directory structure this:

new_project ├── new_project ├──── __init__.py ├──── pipeline.py ├── regression_tests ├──── __init__.py ├──── helpers.py ├──── test_pipeline.py └──── test_connectivity.py 

running python3 -m unittest discover @ new_project level runs tests fine; trying run subset fails matter how try cut it:

python3 -m unittest regression_tests 

with result: ran 0 tests in 0.000s

python3 -m unittest regression_tests.test_pipeline python3 -m unittest regression_tests.test_pipeline.testclass python3 -m unittest regression_tests.test_pipeline.testclass.test_method --- or --- python3 -m unittest regression_tests/test_pipeline.py   

with errors: attributeerror: 'module' object has no attribute 'test_pipeline'

finally completeness fails (as expect pythonpath incorrectly set):

cd regression_tests python3 -m unittest test_pipeline 

with error: importerror: no module named 'regression_tests' (error thrown on line from regression_tests.helpers import helper_method)

i don't think i'm doing that's non-standard here. why unittest discover works unittest <test> fails?

to run sub-directory test cases successfully, need specify directory using below command.

python -m unittest discover -s directoryname -p "test_*" 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -