Created
March 15, 2012 14:47
-
-
Save schmir/2044570 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
def pytest_runtest_setup(item): | |
item.activeCount = threading.activeCount() | |
item.session._setupstate.prepare(item) | |
def pytest_runtest_teardown(item, nextitem): | |
item.session._setupstate.teardown_exact(item, nextitem) | |
after = threading.activeCount() | |
before = item.activeCount | |
assert after == before, "number of threads changed from %s to %s" % (before, after) | |
# def pytest_runtest_call(item): | |
# before = threading.activeCount() | |
# item.runtest() | |
# after = threading.activeCount() | |
# assert after == before, "activeCount changed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment