Skip to content

Commit

Permalink
Drumroll, please! All the awesome process work gets merged into
Browse files Browse the repository at this point in the history
master...
  • Loading branch information
CleanCut committed Jul 24, 2015
2 parents 56e710e + 57e03af commit 963e0a9
Show file tree
Hide file tree
Showing 23 changed files with 873 additions and 254 deletions.
65 changes: 61 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,60 @@
# Version 2.0.0
##### ? July 2015

- Major overhaul of the multiprocessing system. Tests always run in a separate
worker process, even when only one process is specified. The default number
of processes is now the number of logical processors detected instead of 1.
Entire modules are now run in the same worker process by default to avoid both
the overhead of multiple processes loading the same module and the overhead of
running module and class setUp/tearDown multiple times redundantly. Classes
or methods specified individually on the command-line will still be run in
their own worker process. A ton of credit for this feature needs to go to Sam
Spilsbury, who put in considerable time and effort to actually code up the
initial pull request. Fixes issues #68, #70.

- Added a gitter chatroom link to the readme.

- Support for acquiring and releasing arbitrary resources via the
`-i/--initializer` and `-z/--finalizer` options. Use it to setup/teardown
things that an individual worker process will need exclusive access to apart
from the other worker processes.

- We're back at 100% self-test coverage again. Yay!!!

- Twisted's skip functionality is caught and recorded as skips instead of
failures, if your `TestCase` subclasses `twisted.trial.unittest.TestCase` and
sets the class attribute `.skip` to `True`, or a test raises
`twisted.trial.unittest.SkipTest`.

- Better handling of outside-of-test exceptions that occur inside worker
processes.

- We now capture stderr that is emitted during tests and present it after tests
have run, just like we do with stdout.

- Capturing stdout in worker processes more consistently works (no known bugs
left).

- The headers for stdout and stderr are now yellow, for better color scheme
consistency (and so they don't get confused with skip headers).

- Skip report headers now display the dotted test name in bold, just like other
headers do. We are so consistent!

- Fixed the skip report so it goes to the stream instead of stdout.

- Disabled the annoying "Coverage.py warning: No data was collected." message
that started happening a lot, even though coverage was working just fine.

- Colors now work on AppVeyor builds, all hail the pretty colors! (Ironically,
they don't support Windows ansi colors, they wrote their own interpreters for
posix-style color escape codes.)

- We now "close" the process pool instead of "terminating" it, which results in
much better behavior in pypy and Windows, especially for things like tearDown
stuff.


# Version 1.11.0
##### 18 June 2015

Expand Down Expand Up @@ -53,7 +110,7 @@
- Switched to cyan instead of blue on Windows only.

- Stubbed in the beginnings of support for designating initialization to run in
each subprocess to obtain whatever resources might be needed by a single
each process to obtain whatever resources might be needed by a single
process (like its own database, for example).


Expand Down Expand Up @@ -203,7 +260,7 @@ Issue #47.
- Fixed a crash that could occur if an exception was raised during a test
case's setUpClass() or tearDownClass()
- We now explicitly terminate the thread pool and join() it. This makes self
unit tests much easier to clean up on Windows, where the subprocesses would
unit tests much easier to clean up on Windows, where the processes would
block deletion of temporary directories.
- Set up continuous integration for Windows using AppVeyor. Thanks to ionelmc
for the tip! Issue #11.
Expand Down Expand Up @@ -250,7 +307,7 @@ Issue #47.
auto-detect all versions of python (in the form of pythonX.Y) in $PATH and
run many permutations of self tests on each version.
- Fixed a crash that could occur if discovery did not find any tests and
subprocesses was set higher than one.
processes was set higher than one.

- Fixed lots of tests so that they would succeed in all environments.

Expand Down Expand Up @@ -346,7 +403,7 @@ Issue #47.
- Clean - Low redundancy in output. Result stats for each test is lined up in a
vertical column.

- Fast - Can run tests in independent subprocesses.
- Fast - Can run tests in independent processes.

- Powerful - Multi-target + auto-discovery.

Expand Down
13 changes: 6 additions & 7 deletions README-pypi.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
Green
=====

Green is a colorful, clean, fast and powerful test runner for Python unit
tests.

Green is a clean, colorful, fast, multi-process test runner for Python.

Documentation
-------------
Expand All @@ -16,21 +14,22 @@ project.
Features
--------

- **Colorful** - Terminal output makes good use of color when the terminal supports it.
- **Clean** - Low redundancy in output. Result stats for each test is lined up in a vertical column.
- **Fast** - Can run tests in independent subprocesses.
- **Colorful** - Terminal output makes good use of color when the terminal supports it.
- **Fast** - Can run tests in independent processes. (Only 1 by default for compatibility, try "-s 0" for best results)
- **Powerful** - Multi-target + auto-discovery.
- **Traditional** - Use the normal ``unittest`` classes and methods for your unit tests.
- **Descriptive** - Four verbosity levels, from just dots to full docstring output.
- **Convenient** - Bash-completion and ZSH-completion of options and test targets.
- **Thorough** - Built-in, optional integration with `coverage`_
- **Modern** - Supports Python 2.7, 3.3, 3.4, and `PyPy`_
- **Portable** - Completely supports OS X, Linux, and BSDs (and maybe Windows).
- **Modern** - Supports Python 2.7, 3.4+, `PyPy`_ and `PyPy3`_
- **Portable** - Completely supports OS X, Linux, and BSDs (and Windows most of the time).
- **Living** - This project grows and changes. See the `changelog`_


.. _GitHub page for Green: https://github.com/CleanCut/green#green
.. _tutorial on how to correctly layout unit tests: https://github.com/CleanCut/green#unit-test-structure-tutorial
.. _coverage: http://nedbatchelder.com/code/coverage/
.. _PyPy: http://pypy.org
.. _PyPy3: http://pypy.org
.. _changelog: https://github.com/CleanCut/green/blob/master/CHANGELOG.md
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Green
Green: A clean, colorful, fast, multi-process test runner.
=====

[![Join the chat at https://gitter.im/CleanCut/green](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/CleanCut/green?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Expand All @@ -8,8 +8,6 @@ Green
[![Windows Build Status](http://img.shields.io/appveyor/ci/CleanCut/green.svg?style=flat)](https://ci.appveyor.com/project/CleanCut/green)
[![Coverage Status](https://img.shields.io/coveralls/CleanCut/green.svg?style=flat)](https://coveralls.io/r/CleanCut/green?branch=master)

Green is a **clean, colorful test runner** for Python unit tests.

#### Table of Contents

1. [Features](https://github.com/CleanCut/green#features)
Expand All @@ -31,17 +29,17 @@ Green is a **clean, colorful test runner** for Python unit tests.
Features
--------

- **Colorful** - Terminal output makes good use of color when the terminal supports it.
- **Clean** - Low redundancy in output. Result statistics for each test is vertically aligned.
- **Fast** - Tests can run in independent subprocesses.
- **Colorful** - Terminal output makes good use of color when the terminal supports it.
- **Fast** - Tests run in independent processes. (Only 1 by default for compatibility, try `-s 0` for best results)
- **Powerful** - Multi-target + auto-discovery.
- **Traditional** - Use the normal `unittest` classes and methods for your unit tests.
- **Descriptive** - Four verbosity levels, from just dots to full docstring output.
- **Convenient** - Bash-completion and ZSH-completion of options and test targets.
- **Thorough** - Built-in, optional integration with
[coverage](http://nedbatchelder.com/code/coverage/).
- **Modern** - Supports Python 2.7, 3.4+, and [PyPy](http://pypy.org).
- **Portable** - Completely supports OS X, Linux, and BSDs (and maybe Windows).
- **Modern** - Supports Python 2.7, 3.4+, [PyPy](http://pypy.org), and [PyPy3](http://pypy.org).
- **Portable** - Completely supports OS X, Linux, and BSDs (and Windows most of the time).
- **Living** - This project grows and changes. See the
[changelog](https://github.com/CleanCut/green/blob/master/CHANGELOG.md)

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ install:
- "%PYTHON%/python.exe C:/get-pip.py"
- "%PYTHON%/Scripts/pip.exe install -r requirements.txt"
test_script:
- "%PYTHON%/python.exe -m green.cmdline -vvv green"
- "%PYTHON%/python.exe -m green.cmdline -vvv -t green"
platform:
- AnyCPU
29 changes: 22 additions & 7 deletions cli-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,31 @@ Target Specification:
introspection of the object will be loaded.

Concurrency Options:
-s NUM, --subprocesses NUM
Number of subprocesses to use to run tests. Note that
-s NUM, --processes NUM
Number of processes to use to run tests. Note that
your tests need to be written to avoid using the same
resources (temp files, sockets, ports, etc.) for the
multi-process mode to work well. Default is 1, meaning
disable using subprocesses. 0 means try to autodetect
the number of CPUs in the system. Note that for a
small number of trivial tests, running everything in a
multi-process mode to work well (--initializer and
--finalizer can help provision per-process resources).
Default is 1, meaning just use a single process
(maximizes compatibility with standard unittest and
other test runners). 0 means try to autodetect the
number of CPUs in the system. Note that for a small
number of trivial tests, running everything in a
single process may be faster than the overhead of
initializing all the subprocesses.
initializing all the processes.
-i EXECUTABLE_FILE, --initializer EXECUTABLE_FILE
Executable to run inside of a single worker process
before it starts running tests. This is the way to
provision external resources that each concurrent
worker process needs to have exclusive access to. Can
be a relative or absolute path.
-z EXECUTABLE_FILE, --finalizer EXECUTABLE_FILE
Executable to run inside of a single worker process
after it completes running tests and the process is
about to be destroyed. This is the way to reclaim
resources provisioned with --initializer. Can be a
relative or absolute path.

Format Options:
-m, --html THIS OPTION WILL BE REMOVED SOON UNLESS PEOPLE ASK FOR
Expand Down
2 changes: 1 addition & 1 deletion green/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.11.0
2.0.0
2 changes: 1 addition & 1 deletion green/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def main(testing=False, coverage_testing=False):
# Discover/Load the test suite
if testing:
test_suite = None
else:
else: # pragma: no cover
test_suite = loadTargets(args.targets, file_pattern = args.file_pattern)

# We didn't even load 0 tests...
Expand Down
Loading

0 comments on commit 963e0a9

Please sign in to comment.