nose-devs / nose

nose is nicer testing for python
http://readthedocs.org/docs/nose/en/latest/
1.36k stars 397 forks source link

Nosetest fails while running tests directly works #1101

Open Bihaqo opened 4 years ago

Bihaqo commented 4 years ago

I'm trying to run nosetests and it reports a lot of failed tests while running the same tests directly works fine (and takes a lot of time, i.e. it seems that nosetest is not actually running as much code as when running directly). The same code used to work fine with nosetests before the latest changes.

Reproducing the problem: https://colab.research.google.com/drive/1rhyXYbqS_od6yJfNXyZhDL6NL0tkGygx

The codebase: https://github.com/Bihaqo/t3f/tree/full_tf2_support

Latest changes diff: https://github.com/Bihaqo/t3f/pull/201/files

Bihaqo commented 4 years ago

It seems that the problem is that Nose runs all the test files in the same process, polluting Tensorflow state (in some of the test files eager execution is turned off and in others it turned on, and this choice has to be made in the very beginning of the program).

So what I actually need, is to run each test file in a separate process. I tried following this advice: https://stackoverflow.com/questions/31274926/python-nose-unit-testing-using-separate-sequential-python-processes , but it didn't help. Is there any other way of doing it?