Green 2.0.0 Released
Update 2015–09–14: Version 2.0.5 fixes all the regression bugs that have been found so far. Read on for the original story…
Green is a clean, colorful, fast test runner for Python unit tests.
After a ton of hard work, much of it by Sam Spilsbury, a generous code contributor, 2.0.0 is finally out!
The new major version has had its internals overhauled so that now test modules are run in parallel worker processes by default. There’s two important parts to that statement:
- “Test Modules” — In green’s multiprocess mode before now, worker processes processed at the individual test level. This resulted in lots and lots of duplicate overhead related to loading, setting up, and tearing down the test module and test cases. Now, by default, a single worker process runs an entire test module (which corresponds to all the tests in a single python file), which means that all of the overhead cost is only paid once by worker processes.
- “By Default” — Until now, the default mode for green was to run all tests sequentially in the main process, just like other boring, slow test runners. The reason behind this was that we wanted tests to “just work” out of the box when you switch to Green from whatever you started with. Since seemingly 99% of the concurrency bugs occur inside a test module, and we now run entire modules in the same worker process, we’ve side-stepped the issue. Hooray! Of course, if you threw all of your tests into a single module, you’ll want to split them up into multiple sensible modules to experience the speedup.