Assume a folder 'lib/' that contains several unittesting files (ending in '__unittest.py'). I would like to conduct unittesting on all test files in said folder by calling a bash script called TESTING.
michael$ python -m unittest discover -s ./lib/ -p '*__unittest.py'
...................
----------------------------------------------------------------------
Ran 19 tests in 0.001s
OK
michael$ bash <(python -m unittest discover -s ./lib/ -p '*__unittest.py')
...................
----------------------------------------------------------------------
Ran 19 tests in 0.002s
OK
michael$ echo "python -m unittest discover -s ./lib/ -p '*__unittest.py'" > TESTING
michael$ bash <(cat TESTING)
EEE
======================================================================
ERROR: CheckingOps__unittest (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: CheckingOps__unittest
Traceback (most recent call last):
...
ImportError: No module named 'Bio'
It would appear that I cannot conduct unittesting by calling the bash script, as, then, Python does not import the library Bio. Why would that be and how can I resolve this?
EDIT 1: Same result (of course) when calling script directly.
michael$ bash TESTING
EEE
======================================================================
ERROR: CheckingOps__unittest (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: CheckingOps__unittest
Traceback (most recent call last):
...
ImportError: No module named 'Bio'
Aucun commentaire:
Enregistrer un commentaire