Equivalent of nose's --process-restartworker
See original GitHub issueIn our project, we have a process-level cache. On Windows with nose test framework, we can use --process-restartworker
to isolate each ScenarioTest
in a different process. However, with pytest if multiple ScenarioTest
s are assigned to the same process, there will be conflicts in the cache.
With pytest, is there an equivalent of --process-restartworker
? If --forked
doesn’t work on Windows, is it possible to just restart the process instead?
Also see: https://stackoverflow.com/questions/48234032/run-py-test-test-in-different-process https://stackoverflow.com/questions/45462374/mark-test-to-be-run-in-independent-process https://stackoverflow.com/questions/51187188/pytest-run-each-test-in-a-separate-process
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Basic usage — nose 1.3.7 documentation - Nosetests
All plugins written for nose 0.10 and 0.11 should work with nose 1.0. ... If set, will restart each worker process once their...
Read more >plugins/multiprocess.py · squarecapadmin/nose - Gemfury
When the worker process finishes, it returns results to the main nose process. ... added ``--process-restartworker`` option to restart workers once they are ......
Read more >nose multiprocess problems - python - Stack Overflow
I'm having a problem running nose tests. When I run my suite from Eclipse, using Run As>Python unit-test with the test runner set...
Read more >Multiprocess: parallel testing — nose 1.3.7 documentation
If set, will restart each worker process once their tests are done, this helps control memory leaks from killing the system. [NOSE_PROCESS_RESTARTWORKER] ...
Read more >nose Documentation - Read the Docs
Output nose version and exit. -p, --plugins ... --process-restartworker. If set, will restart each worker process once their tests are done, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @jiasli,
Seems like just resetting the cache after each test would suffice? This can easily be accomplished by just using a
autouse
fixture on your top-levelconftest.py
file:This is simple and will be faster than executing each test in its own process.
Having said that, out of curiosity, I wrote a simple plugin which executes each test in a separate process:
This kind of works:
But it has a lot of caveats:
This might work fine for very simple test suites with simple fixtures, but caution is warranted.
I think so, though I am not an expert on process management. The cost is affordable to us, compared to the effort we need to make each test case nice and clean.