1

I have a directory tests that contains many test files. When I test them one by one, they all work and return something like this :

Ran 2 tests in 0.005s

OK (expected failures=1)

But when I run this command : python -m unittest discover inside the test folder, I get :

Ran 27 tests in 13.950s

FAILED (failures=3, errors=1, expected failures=9)

Why the discover command finds errors? (I am sure that all the tests are working, it's just that the functions I'm testing are a little bit complex and related. Is there any other clean way to launch the tests in one time without getting errors ?

JavaQueen
  • 1,155
  • 2
  • 19
  • 44
  • 1
    Sounds like you need to isolate your test data. You probably have some data that is being changed by Test X, and then Accessed by Test Y. Look at the failing tests and how they fail to help track this down. – elethan Jan 11 '17 at 15:21
  • @elethan that's not it; my data are not the issue. they are isolated – JavaQueen Jan 11 '17 at 15:35
  • Can you provide a few examples of tests that work when run independently but fail when run as a suite? – elethan Jan 11 '17 at 15:49
  • how about `nosetests -vw tests`? – Gang Jan 12 '17 at 06:14

0 Answers0