Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
2545c60c
Commit
2545c60c
authored
Nov 09, 2018
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on some flaky appveyor tests.
parent
5a8d1254
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
8 deletions
+61
-8
src/gevent/testing/flaky.py
src/gevent/testing/flaky.py
+5
-2
src/gevent/testing/patched_tests_setup.py
src/gevent/testing/patched_tests_setup.py
+20
-1
src/gevent/testing/testcase.py
src/gevent/testing/testcase.py
+7
-3
src/gevent/tests/known_failures.py
src/gevent/tests/known_failures.py
+26
-0
src/gevent/tests/test__api_timeout.py
src/gevent/tests/test__api_timeout.py
+2
-1
src/gevent/tests/test__subprocess.py
src/gevent/tests/test__subprocess.py
+1
-1
No files found.
src/gevent/testing/flaky.py
View file @
2545c60c
...
...
@@ -96,7 +96,7 @@ if sysinfo.RUNNING_ON_CI or (sysinfo.PYPY and sysinfo.WIN):
reraiseFlakyTestTimeoutLibuv
=
reraiseFlakyTestTimeout
def
reraises_flaky_timeout
(
exc_kind
):
def
reraises_flaky_timeout
(
exc_kind
=
AssertionError
,
_func
=
reraiseFlakyTestTimeout
):
def
wrapper
(
f
):
@
functools
.
wraps
(
f
)
...
...
@@ -104,7 +104,10 @@ def reraises_flaky_timeout(exc_kind):
try
:
f
(
*
args
)
except
exc_kind
:
reraiseFlakyTestTimeout
()
_func
()
return
m
return
wrapper
def
reraises_flaky_race_condition
(
exc_kind
=
AssertionError
):
return
reraises_flaky_timeout
(
exc_kind
,
_func
=
reraiseFlakyTestRaceCondition
)
src/gevent/testing/patched_tests_setup.py
View file @
2545c60c
...
...
@@ -34,6 +34,8 @@ from .sysinfo import OSX
from
.sysinfo
import
LIBUV
from
.sysinfo
import
CFFI_BACKEND
from
.
import
flaky
CPYTHON
=
not
PYPY
# By default, test cases are expected to switch and emit warnings if there was none
...
...
@@ -536,6 +538,14 @@ def _gc_at_end():
gc
.
collect
()
gc
.
collect
()
@
contextlib
.
contextmanager
def
_flaky_socket_timeout
():
import
socket
try
:
yield
except
socket
.
timeout
:
flaky
.
reraiseFlakyTestTimeout
()
# Map from FQN to a context manager that will be wrapped around
# that test.
wrapped_tests
=
{
...
...
@@ -577,6 +587,10 @@ if WIN:
'test_ssl.ThreadedTests.test_socketserver'
,
]
wrapped_tests
.
update
({
'test_socket.SendfileUsingSendTest.testWithTimeout'
:
_flaky_socket_timeout
})
if
PYPY
:
disabled_tests
+=
[
# Does not exist in the CPython test suite, tests for a specific bug
...
...
@@ -1085,9 +1099,10 @@ def disable_tests_in_source(source, filename):
# so use [ \t]+. Without indentation, test_main, commonly used as the
# __main__ function at the top level, could get matched. \s matches
# newlines even in MULTILINE mode so it would still match that.
my_disabled_testcases
=
set
()
for
test
in
my_disabled_tests
:
testcase
=
test
.
split
(
'.'
)[
-
1
]
my_disabled_testcases
.
add
(
testcase
)
# def foo_bar(self)
# ->
# @_GEVENT_UTS.skip('Removed by patched_tests_setup')
...
...
@@ -1101,6 +1116,10 @@ def disable_tests_in_source(source, filename):
for
test
in
my_wrapped_tests
:
testcase
=
test
.
split
(
'.'
)[
-
1
]
if
testcase
in
my_disabled_testcases
:
print
(
"Not wrapping %s because it is skipped"
%
(
test
,))
continue
# def foo_bar(self)
# ->
# @_GEVENT_PTS._PatchedTest('file.Case.name')
...
...
src/gevent/testing/testcase.py
View file @
2545c60c
...
...
@@ -37,6 +37,7 @@ from . import flaky
from
.patched_tests_setup
import
get_switch_expected
class
TimeAssertMixin
(
object
):
@
flaky
.
reraises_flaky_timeout
()
def
assertTimeoutAlmostEqual
(
self
,
first
,
second
,
places
=
None
,
msg
=
None
,
delta
=
None
):
try
:
self
.
assertAlmostEqual
(
first
,
second
,
places
=
places
,
msg
=
msg
,
delta
=
delta
)
...
...
@@ -64,9 +65,12 @@ class TimeAssertMixin(object):
start
=
time
()
yield
elapsed
=
time
()
-
start
try
:
self
.
assertTrue
(
expected
-
fuzzy
<=
elapsed
<=
expected
+
fuzzy
,
'Expected: %r; elapsed: %r; fuzzy %r'
%
(
expected
,
elapsed
,
fuzzy
))
except
AssertionError
:
flaky
.
reraiseFlakyTestRaceCondition
()
def
runs_in_no_time
(
self
,
...
...
src/gevent/tests/known_failures.py
View file @
2545c60c
...
...
@@ -85,6 +85,32 @@ if sys.platform == 'win32':
# too tight for appveyor. This happens even if Event isn't
# monkey-patched
'FLAKY test_threading.py'
,
# Starting in November 2018, on Python 3.7.0, we observe this test crashing.
# I can't reproduce locally.
# | C:\Python37-x64\python.exe -u -mgevent.tests.test__greenness
# 127.0.0.1 - - [09/Nov/2018 16:34:12] code 501, message Unsupported method ('GET')
# 127.0.0.1 - - [09/Nov/2018 16:34:12] "GET / HTTP/1.1" 501 -
# .
# ----------------------------------------------------------------------
# Ran 1 test in 0.031s
# OK
# Windows fatal exception: access violation
# Current thread 0x000003c8 (most recent call first):
# File "c:\projects\gevent\src\gevent\threadpool.py", line 261 in _worker
# Thread 0x00000600 (most recent call first):
# File "c:\projects\gevent\src\gevent\libuv\watcher.py", line 577 in send
# File "c:\projects\gevent\src\gevent\threadpool.py", line 408 in set
# File "c:\projects\gevent\src\gevent\threadpool.py", line 290 in _worker
# Thread 0x000007d4 (most recent call first):
# File "C:\Python37-x64\lib\weakref.py", line 356 in remove
# ! C:\Python37-x64\python.exe -u -mgevent.tests.test__greenness [code 3221225477] [took 1.3s]
'FLAKY test__greenness.py'
,
]
if
not
PY35
:
...
...
src/gevent/tests/test__api_timeout.py
View file @
2545c60c
...
...
@@ -31,6 +31,7 @@ from gevent import get_hub
from
gevent.testing.timing
import
SMALL_TICK
as
DELAY
from
gevent.testing
import
flaky
class
Error
(
Exception
):
...
...
@@ -174,7 +175,7 @@ class Test(greentest.TestCase):
gc
.
collect
()
self
.
assertFalse
(
err_ref
(),
err_ref
)
@
flaky
.
reraises_flaky_race_condition
()
def
test_nested_timeout
(
self
):
with
Timeout
(
DELAY
,
False
):
with
Timeout
(
DELAY
*
10
,
False
):
...
...
src/gevent/tests/test__subprocess.py
View file @
2545c60c
...
...
@@ -385,7 +385,7 @@ class TestFDs(unittest.TestCase):
class
RunFuncTestCase
(
greentest
.
TestCase
):
# Based on code from python 3.6
__timeout__
=
6
__timeout__
=
greentest
.
LARGE_TIMEOUT
def
run_python
(
self
,
code
,
**
kwargs
):
"""Run Python code in a subprocess using subprocess.run"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment