[TIP] Coverage kills python with sys.settrace(None): how to work around?

Michael McNeil Forbes michael.forbes+python at gmail.com
Mon Mar 9 02:52:55 PDT 2015


I am trying to run coverage via nosetests from setup.py, but once the coverage report is produced, coverage calls sys.settrace(None) which rapidly kills everything and I can no longer continue processing.  (I would like to run some additional tests after like pep8 syntax checks etc.)

How can I run coverage on my tests and then continue with other checks if everything is successful?

Thanks,
Michael.

P.S.

I am subclassing Command in my setup.py file defining a run command like:

  def run(self):
      self.run_command('nosetests')
      self.run_command('flake8')
      self.run_command('check')

Even if all the nosetests pass, coverage kills everything when the tracer is stopped.  As such, I can't even catch an exception.


More information about the testing-in-python mailing list