I'm fairly green with python testing, so this might be something I'm doing wrong..
When I run my tests, the test runners works fine and coverage too.. but between the two I get an assertion error:
Traceback (most recent call last):
  File "/usr/local/bin/coverage", line 9, in <module>
    load_entry_point('coverage==3.5.1', 'console_scripts', 'coverage')()
  File "/usr/local/lib/python2.7/dist-packages/coverage/cmdline.py", line 657, in main
    status = CoverageScript().command_line(argv)
  File "/usr/local/lib/python2.7/dist-packages/coverage/cmdline.py", line 526, in command_line
    self.coverage.stop()
  File "/usr/local/lib/python2.7/dist-packages/coverage/control.py", line 389, in stop
    self.collector.stop()
  File "/usr/local/lib/python2.7/dist-packages/coverage/collector.py", line 262, in stop
    assert self._collectors[-1] is self
AssertionError
To make thing more difficult, I'm trying to test a command line utility. Which means I had to tell coverage to cover subprocess calls.
I think I got this part working since coverage is now reporting a % of cover for the script that is being run. But since I got coverage working I can't get rid of the AssertionError.
Some help understanding what's wrong would be really appreciated. All my code is available on github:
Quick run:
cd /tmp/ && git clone git://github.com/h3/django-duke-client.git 
cd django-duke-client && chmod a+x run_tests && ./run_tests
Thanks
Update
I've run the test on a different computer and I got the same AssertionError .. Plus a new TypeError. Again the tests runs correctly and coverage also seems to work properly even with those errors..
...
Ran 9 tests in 1.324s
OK
Traceback (most recent call last):
  File "/usr/local/bin/coverage", line 9, in <module>
    load_entry_point('coverage==3.5.1', 'console_scripts', 'coverage')()
  File "/usr/local/lib/python2.7/dist-packages/coverage/cmdline.py", line 657, in main
    status = CoverageScript().command_line(argv)
  File "/usr/local/lib/python2.7/dist-packages/coverage/cmdline.py", line 526, in command_line
    self.coverage.stop()
  File "/usr/local/lib/python2.7/dist-packages/coverage/control.py", line 389, in stop
    self.collector.stop()
  File "/usr/local/lib/python2.7/dist-packages/coverage/collector.py", line 262, in stop
    assert self._collectors[-1] is self
AssertionError
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.7/multiprocessing/util.py", line 284, in _exit_function
    info('process shutting down')
TypeError: 'NoneType' object is not callable
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.7/multiprocessing/util.py", line 284, in _exit_function
    info('process shutting down')
TypeError: 'NoneType' object is not callable
Name                               Stmts   Miss Branch BrPart  Cover   Missing
------------------------------------------------------------------------------
dukeclient/__init__                   53     53      2      0     4%   1-93
dukeclient/commands/__init__          41     33      6      2    26%   1-9, 12, 14-15, 17, 24-28, 34-43, 46-63
...
                Regarding the NoneType is not callable error, please find below some elements that may help you.
In your module plugintest.py from nose-1.1.2-py2.7.egg/nose/plugins/, line 174, one can read the following line :
from multiprocessing import Manager
That leads the multiprocessing.util package to be imported, and with it an exit function to be registered :
atexit.register(_exit_function)
The problem seems to be that multiprocessing.util which is loaded in plugintest is then unloaded before the _exit_function gets called, and it's function definitions by the way.
Thus, if you import it in your setup.py file :
from multiprocessing import util
The error disappear.
By the way, I had to comment some parts in the tests that were failing or change some lines of code :
-m command does not seems to be valid ;duke_conf.yml to duke_conf.yml ;README.rst and LICENSE files exists are failing (don't had the time to check why) ; Hope it helps,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With