Commit 92812e46 authored by Jason Madden's avatar Jason Madden

The monkey test runner needs to handle SkipTest exceptions.

parent 0aed91b1
......@@ -23,6 +23,7 @@ from .sysinfo import PY37
from .patched_tests_setup import disable_tests_in_source
from . import support
from . import resources
from . import SkipTest
if RUNNING_ON_APPVEYOR and PY37:
# 3.7 added a stricter mode for thread cleanup.
......@@ -73,5 +74,14 @@ try:
'exec',
dont_inherit=True)
exec(module_code, globals())
except SkipTest as e:
# Some tests can raise test.support.ResourceDenied
# in their main method before the testrunner takes over.
# That's a kind of SkipTest. we can't get a skip count because it
# hasn't run, though.
print(e)
# Match the regular unittest output, including ending with skipped
print("Ran 0 tests in 0.0s")
print('OK (skipped=0)')
finally:
os.remove(temp_path)
......@@ -97,6 +97,11 @@ class Runner(object):
failfast=False,
quiet=False,
configured_run_alone_tests=()):
"""
:keyword quiet: Set to True or False to explicitly choose. Set to
`None` to use the default, which may come from the environment variable
``GEVENTTEST_QUIET``.
"""
self._tests = tests
self._configured_failing_tests = configured_failing_tests
self._failfast = failfast
......@@ -110,6 +115,7 @@ class Runner(object):
self._worker_count = min(len(tests), NWORKERS) or 1
def _run_one(self, cmd, **kwargs):
if self._quiet is not None:
kwargs['quiet'] = self._quiet
result = util.run(cmd, **kwargs)
if not result and self._failfast:
......
......@@ -106,7 +106,9 @@ def TESTRUNNER(tests=None):
def main():
from gevent.testing import testrunner
return testrunner.Runner(list(TESTRUNNER(sys.argv[1:])))()
discovered_tests = TESTRUNNER(sys.argv[1:])
discovered_tests = list(discovered_tests)
return testrunner.Runner(discovered_tests, quiet=None)()
if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment