mercredi 24 juillet 2019

Run python test modules independtly

I have two different modules (test_a.py, test_b.py) with tests written using unittest.Tescase under one unique folder (tests_folder). If I run the tests of each module with:

python -m unittest tests_folder.test_a.py
python -m unittest tests_folder.test_b.py 

They all pass, but if I run the command:

python -m unittest discover tests_folder

Tests fail. I know this is happenning because of mocking, since I am mocking some classes in one module which are aleady imported in the other module which makes mocking not working. So I need to run the modules completely independet. Is there any way for doing this? Thanks!!

Aucun commentaire:

Enregistrer un commentaire