-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
OS: linux ubuntu 18.04.1
Pytest version: 4.0.1
If you use the python logging library and log something during teardown, it causes a crash if the teardown runs due to cancelling the test e.g. using ctrl-c and causing a keyboard interrupt.
This is a new bug in pytest 4.0, if I run it with 3.9 it works fine.
https://stackoverflow.com/questions/53591387/pytest-error-in-teardown-when-using-logging
yield something
logging.info("it crashes due to this but only if you cancel the test")
print ("that means this isn't printed and nothing past here runs")
The error you get is this:
File "/home/oscar/.local/lib/python3.6/site-packages/_pytest/capture.py", line 167, in global_and_fixture_disabled
self.resume_global_capture()
File "/home/oscar/.local/lib/python3.6/site-packages/_pytest/capture.py", line 120, in resume_global_capture
self._global_capturing.resume_capturing()
AttributeError: 'NoneType' object has no attribute 'resume_capturing'