Skip to content

Commit

Permalink
No, really allow unittest on Py 3.12.1 to have skipped tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Dec 13, 2023
1 parent 33072f9 commit 8ea9605
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/gevent/testing/testrunner.py
Expand Up @@ -161,6 +161,7 @@ def __init__(self,
self._allowed_return_codes = allowed_return_codes

def _run_one(self, cmd, **kwargs):
kwargs['allowed_return_codes'] = self._allowed_return_codes
if self._quiet is not None:
kwargs['quiet'] = self._quiet
result = util.run(cmd, **kwargs)
Expand Down
14 changes: 10 additions & 4 deletions src/gevent/testing/util.py
Expand Up @@ -260,7 +260,6 @@ class RunResult(object):
value of True; otherwise, a boolean value of false.
The integer value of this object is the command's exit code.
"""

def __init__(self,
Expand Down Expand Up @@ -394,7 +393,9 @@ def run(command, **kwargs): # pylint:disable=too-many-locals
kill(popen)
assert popen.timer is None


# We don't want to treat return codes that are allowed as failures,
# but we do want to log those specially. That's why we retain the distinction
# between ``failed`` and ``result`` (failed takes the allowed codes into account).
failed = bool(result) and result not in allowed_return_codes
if out:
out = out.strip()
Expand All @@ -406,11 +407,16 @@ def run(command, **kwargs): # pylint:disable=too-many-locals
log('| %s\n%s', name, out)
status, run_count, skipped_count = _find_test_status(duration, out)
if result:
log('! %s [code %s] %s', name, result, status, color='error')
log('! %s [code %s] %s', name, result, status,
color='error' if failed else 'suboptimal-behaviour')
elif not nested:
log('- %s %s', name, status)

# For everything outside this function, we need to pretend that
# allowed codes are actually successes.
return RunResult(
command, kwargs, result,
command, kwargs,
0 if result in allowed_return_codes else result,
output=out, error=err,
name=name,
run_count=run_count,
Expand Down

0 comments on commit 8ea9605

Please sign in to comment.