Commit c337edea authored by Jason Madden's avatar Jason Madden

Tweak a timer value, seen a failure in libev-cffi on travis.

parent 4749d429
...@@ -332,33 +332,33 @@ def print_list(lst): ...@@ -332,33 +332,33 @@ def print_list(lst):
for name in lst: for name in lst:
log(' - %s', name) log(' - %s', name)
def _setup_environ(): def _setup_environ(debug=False):
if 'PYTHONWARNINGS' not in os.environ and not sys.warnoptions: if 'PYTHONWARNINGS' not in os.environ and not sys.warnoptions:
# Enable default warnings such as ResourceWarning.
# On Python 3[.6], the system site.py module has
# "open(fullname, 'rU')" which produces the warning that
# 'U' is deprecated, so ignore warnings from site.py
# importlib/_bootstrap.py likes to spit out "ImportWarning:
# can't resolve package from __spec__ or __package__, falling
# back on __name__ and __path__". I have no idea what that means, but it seems harmless
# and is annoying.
# pkgutil on Python 2 complains about missing __init__.py
# action:message:category:module:line # action:message:category:module:line
os.environ['PYTHONWARNINGS'] = ','.join([ os.environ['PYTHONWARNINGS'] = ','.join([
# Enable default warnings such as ResourceWarning.
'default', 'default',
# On Python 3[.6], the system site.py module has
# "open(fullname, 'rU')" which produces the warning that
# 'U' is deprecated, so ignore warnings from site.py
'ignore:::site:', 'ignore:::site:',
# pkgutil on Python 2 complains about missing __init__.py
'ignore:::pkgutil', 'ignore:::pkgutil',
# importlib/_bootstrap.py likes to spit out "ImportWarning:
# can't resolve package from __spec__ or __package__, falling
# back on __name__ and __path__". I have no idea what that means, but it seems harmless
# and is annoying.
'ignore:::importlib._bootstrap:', 'ignore:::importlib._bootstrap:',
'ignore:::importlib._bootstrap_external:', 'ignore:::importlib._bootstrap_external:',
# importing ABCs from collections, not collections.abc
'ignore:::pkg_resources._vendor.pyparsing:',
]) ])
if 'PYTHONFAULTHANDLER' not in os.environ: if 'PYTHONFAULTHANDLER' not in os.environ:
os.environ['PYTHONFAULTHANDLER'] = 'true' os.environ['PYTHONFAULTHANDLER'] = 'true'
if 'GEVENT_DEBUG' not in os.environ: if 'GEVENT_DEBUG' not in os.environ and debug:
os.environ['GEVENT_DEBUG'] = 'debug' os.environ['GEVENT_DEBUG'] = 'debug'
if 'PYTHONTRACEMALLOC' not in os.environ: if 'PYTHONTRACEMALLOC' not in os.environ:
...@@ -390,6 +390,7 @@ def main(): ...@@ -390,6 +390,7 @@ def main():
parser.add_argument("--coverage", action="store_true") parser.add_argument("--coverage", action="store_true")
parser.add_argument("--quiet", action="store_true", default=True) parser.add_argument("--quiet", action="store_true", default=True)
parser.add_argument("--verbose", action="store_false", dest='quiet') parser.add_argument("--verbose", action="store_false", dest='quiet')
parser.add_argument("--debug", action="store_true", default=False)
parser.add_argument('tests', nargs='*') parser.add_argument('tests', nargs='*')
options = parser.parse_args() options = parser.parse_args()
FAILING_TESTS = [] FAILING_TESTS = []
...@@ -408,7 +409,7 @@ def main(): ...@@ -408,7 +409,7 @@ def main():
os.environ['COVERAGE_FILE'] = os.path.abspath(".") + os.sep + ".coverage" os.environ['COVERAGE_FILE'] = os.path.abspath(".") + os.sep + ".coverage"
print("Enabling coverage to", os.environ['COVERAGE_FILE']) print("Enabling coverage to", os.environ['COVERAGE_FILE'])
_setup_environ() _setup_environ(debug=options.debug)
if options.config: if options.config:
config = {} config = {}
......
...@@ -112,6 +112,9 @@ class TestTimerResolution(Test): ...@@ -112,6 +112,9 @@ class TestTimerResolution(Test):
loop = self.loop loop = self.loop
timer_multiplier = 11
max_time = self.timer_duration * timer_multiplier
assert max_time < 0.3
for _ in range(150): for _ in range(150):
# in libuv, our signal timer fires every 300ms; depending on # in libuv, our signal timer fires every 300ms; depending on
...@@ -138,7 +141,7 @@ class TestTimerResolution(Test): ...@@ -138,7 +141,7 @@ class TestTimerResolution(Test):
self.assertEqual(1, len(fired_at)) self.assertEqual(1, len(fired_at))
self.assertTimeWithinRange(fired_at[0] - now, self.assertTimeWithinRange(fired_at[0] - now,
0, 0,
self.timer_duration * 5) max_time)
if not greentest.RUNNING_ON_CI: if not greentest.RUNNING_ON_CI:
......
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