forked from gabrielfalcao/lettuce
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make unit tests runnable after functional tests in the same process.
This fixes the raised in gabrielfalcao#52 where the unit tests would not pass if run in the same process and after functional tests were run (the default way that nosetests run thems). This commit fixes that. The registries are cleared and only the desired steps are defined. The issue at hand is the global `STEP_REGISTRY`, while a good idea, it was in an invalid state because of the way nosetests loads, then runs code. All test modules were being loaded into memory and the various steps were being defined inside tests.unit.test_step_runner. Once the tests started running, the tests in tests.functional.test_runner with `prepare_std*` setup methods were blowing away the steps that were stored in the `STEP_REGISTRY`. *NOTE*: This still wouldn't be thread safe (so far as I know) if you were to try to run all of the test methods in parallel you'd end up with each one of them trying to kill and setup the correct environment. There are ways to fix that, but they add additional complexity for something that's not widely done inside the Python community (yet, at least).
- Loading branch information
1 parent
d6f2d2c
commit 7f6e852
Showing
1 changed file
with
33 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters