Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Partial fix for Python 3.12 #158

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/zope/testrunner/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class OutputFormatter:

def __init__(self, options):
self.options = options
self.last_width = 0
self.test_width = self.last_width = 0
self.compute_max_width()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I don't know if it's enough to initialize test_width here, or if it should also be reset to 0 in every test_success()/test_error()/test_failure().


progress = property(lambda self: self.options.progress)
Expand Down
10 changes: 6 additions & 4 deletions src/zope/testrunner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,9 +1019,10 @@ def stopTest(self, test):
self.testTearDown()
# Without clearing, cyclic garbage referenced by the test
# would be reported in the following test.
test.__dict__.clear()
test.__dict__.update(self._test_state)
del self._test_state
if hasattr(self, '_test_state'):
test.__dict__.clear()
test.__dict__.update(self._test_state)
del self._test_state
cycles = None
if (uses_refcounts and self.options.gc_after_test and
self.options.verbose >= 4):
Expand Down Expand Up @@ -1052,9 +1053,10 @@ def stopTest(self, test):
# printed for every subsequent test.

# Did the test leave any new threads behind?
old_threads = getattr(self, '_threads', ())
new_threads = []
for t in threadsupport.enumerate():
if t.is_alive() and t not in self._threads:
if t.is_alive() and t not in old_threads:
if not any([re.match(p, t.name)
for p in self.options.ignore_new_threads]):
new_threads.append(t)
Expand Down