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
664e34da
Commit
664e34da
authored
Jan 18, 2018
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define an exception class at top level to make the leakchecker happy.
parent
3b30b448
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
36 deletions
+41
-36
src/greentest/greentest/monkey_test.py
src/greentest/greentest/monkey_test.py
+1
-3
src/greentest/greentest/patched_tests_setup.py
src/greentest/greentest/patched_tests_setup.py
+34
-24
src/greentest/greentest/sysinfo.py
src/greentest/greentest/sysinfo.py
+1
-0
src/greentest/greentest/testcase.py
src/greentest/greentest/testcase.py
+1
-1
src/greentest/test___monkey_patching.py
src/greentest/test___monkey_patching.py
+2
-2
src/greentest/test__event.py
src/greentest/test__event.py
+2
-6
No files found.
src/greentest/monkey_test.py
→
src/greentest/
greentest/
monkey_test.py
View file @
664e34da
...
...
@@ -16,7 +16,7 @@ print('Running with patch_all(%s): %s' % (','.join('%s=%r' % x for x in kwargs.i
from
gevent
import
monkey
;
monkey
.
patch_all
(
**
kwargs
)
from
patched_tests_setup
import
disable_tests_in_source
from
greentest.
patched_tests_setup
import
disable_tests_in_source
try
:
from
test
import
support
except
ImportError
:
...
...
@@ -24,8 +24,6 @@ except ImportError:
support
.
is_resource_enabled
=
lambda
*
args
:
True
del
support
.
use_resources
if
sys
.
version_info
[:
2
]
<=
(
2
,
6
):
support
.
TESTFN
+=
'_%s'
%
os
.
getpid
()
__file__
=
os
.
path
.
join
(
os
.
getcwd
(),
test_filename
)
...
...
src/greentest/patched_tests_setup.py
→
src/greentest/
greentest/
patched_tests_setup.py
View file @
664e34da
...
...
@@ -13,21 +13,24 @@ import os
# import platform
import
re
# XXX: These are mainly repeats of what's in greentest. Extract these to a common module.
from
greentest.sysinfo
import
RUNNING_ON_APPVEYOR
as
APPVEYOR
from
greentest.sysinfo
import
RUNNING_ON_TRAVIS
as
TRAVIS
from
greentest.sysinfo
import
RESOLVER_ARES
as
ARES
TRAVIS
=
os
.
environ
.
get
(
"TRAVIS"
)
==
"true"
APPVEYOR
=
os
.
environ
.
get
(
'APPVEYOR'
)
OSX
=
sys
.
platform
==
'darwin'
PYPY
=
hasattr
(
sys
,
'pypy_version_info'
)
CPYTHON
=
not
PYPY
WIN
=
sys
.
platform
.
startswith
(
"win"
)
PY2
=
sys
.
version_info
[
0
]
<
3
PY3
=
sys
.
version_info
[
0
]
>=
3
ARES
=
os
.
environ
.
get
(
'GEVENT_RESOLVER'
)
==
'ares'
from
greentest.sysinfo
import
PYPY
from
greentest.sysinfo
import
PYPY3
from
greentest.sysinfo
import
PY3
from
greentest.sysinfo
import
PY2
from
greentest.sysinfo
import
PY34
from
greentest.sysinfo
import
PY35
from
greentest.sysinfo
import
PY36
from
greentest.sysinfo
import
WIN
from
greentest.sysinfo
import
OSX
# XXX: Formalize this better
LIBUV
=
os
.
getenv
(
'GEVENT_CORE_CFFI_ONLY'
)
==
'libuv'
or
(
PYPY
and
WIN
)
from
greentest.sysinfo
import
LIBUV
CPYTHON
=
not
PYPY
# By default, test cases are expected to switch and emit warnings if there was none
# If a test is found in this list, it's expected not to switch.
...
...
@@ -516,19 +519,19 @@ if sys.version_info[:3] <= (2, 7, 11):
'test_ssl.ThreadedTests.test__https_verify_envvar'
,
]
if
sys
.
platform
==
'darwin'
:
if
OSX
:
disabled_tests
+=
[
'test_subprocess.POSIXProcessTestCase.test_run_abort'
,
# causes Mac OS X to show "Python crashes" dialog box which is annoying
]
if
sys
.
platform
.
startswith
(
'win'
)
:
if
WIN
:
disabled_tests
+=
[
# Issue with Unix vs DOS newlines in the file vs from the server
'test_ssl.ThreadedTests.test_socketserver'
,
]
if
hasattr
(
sys
,
'pypy_version_info'
)
:
if
PYPY
:
disabled_tests
+=
[
'test_subprocess.ProcessTestCase.test_failed_child_execute_fd_leak'
,
# Does not exist in the CPython test suite, tests for a specific bug
...
...
@@ -539,7 +542,7 @@ if hasattr(sys, 'pypy_version_info'):
# Generic Python 3
if
sys
.
version_info
[
0
]
==
3
:
if
PY
3
:
disabled_tests
+=
[
# Triggers the crash reporter
...
...
@@ -627,7 +630,7 @@ if sys.version_info[0] == 3:
# PyPy3 3.5.5 v5.8-beta
if
hasattr
(
sys
,
'pypy_version_info'
)
and
sys
.
version_info
[:
2
]
>=
(
3
,
3
)
:
if
PYPY3
:
disabled_tests
+=
[
...
...
@@ -638,7 +641,7 @@ if hasattr(sys, 'pypy_version_info') and sys.version_info[:2] >= (3, 3):
]
if
hasattr
(
sys
,
'pypy_version_info'
)
and
sys
.
pypy_version_info
[:
4
]
in
(
# pylint:disable=no-member
if
PYPY
and
sys
.
pypy_version_info
[:
4
]
in
(
# pylint:disable=no-member
(
5
,
8
,
0
,
'beta'
),
(
5
,
9
,
0
,
'beta'
),
):
# 3.5 is beta. Hard to say what are real bugs in us vs real bugs in pypy.
...
...
@@ -682,7 +685,7 @@ if hasattr(sys, 'pypy_version_info') and sys.pypy_version_info[:4] in ( # pylint
'test_threading.ThreadJoinOnShutdown.test_1_join_on_shutdown'
,
]
if
hasattr
(
sys
,
'pypy_version_info'
)
:
if
PYPY
:
wrapped_tests
.
update
({
# XXX: gevent: The error that was raised by that last call
...
...
@@ -706,7 +709,7 @@ if hasattr(sys, 'pypy_version_info'):
'test_urllib2_localnet.TestUrlopen.test_https_with_cafile'
:
_gc_at_end
,
})
if
sys
.
version_info
[:
2
]
==
(
3
,
4
)
and
sys
.
version_info
[:
3
]
<
(
3
,
4
,
4
):
if
PY34
and
sys
.
version_info
[:
3
]
<
(
3
,
4
,
4
):
# Older versions have some issues with the SSL tests. Seen on Appveyor
disabled_tests
+=
[
'test_ssl.ContextTests.test_options'
,
...
...
@@ -715,7 +718,7 @@ if sys.version_info[:2] == (3, 4) and sys.version_info[:3] < (3, 4, 4):
'test_httplib.HTTPSTest.test_networked'
,
]
if
sys
.
version_info
[:
2
]
>=
(
3
,
4
)
:
if
PY34
:
disabled_tests
+=
[
'test_subprocess.ProcessTestCase.test_threadsafe_wait'
,
# XXX: It seems that threading.Timer is not being greened properly, possibly
...
...
@@ -759,7 +762,7 @@ if sys.version_info[:2] >= (3, 4):
'test_httplib.HeaderTests.test_parse_all_octets'
,
]
if
sys
.
platform
==
'darwin'
:
if
OSX
:
disabled_tests
+=
[
# These raise "OSError: 12 Cannot allocate memory" on both
# patched and unpatched runs
...
...
@@ -795,7 +798,7 @@ if sys.version_info[:2] >= (3, 4):
# but fails under Travis
]
if
sys
.
version_info
[:
2
]
>=
(
3
,
5
)
:
if
PY35
:
disabled_tests
+=
[
# XXX: Hangs
'test_ssl.ThreadedTests.test_nonblocking_send'
,
...
...
@@ -833,6 +836,13 @@ if sys.version_info[:2] >= (3, 5):
'test_socket.GeneralModuleTests.test_getnameinfo'
,
]
if
LIBUV
and
sys
.
version_info
[
1
]
==
5
:
disabled_tests
+=
[
# This test tends to time out, but only under 3.5, not under
# 3.6 or 3.7
'test_socket.SendfileUsingSendTest.testWithTimeoutTriggeredSend'
,
]
if
sys
.
version_info
[:
3
]
<=
(
3
,
5
,
1
):
# Python issue 26499 was fixed in 3.5.2 and these tests were added.
disabled_tests
+=
[
...
...
@@ -843,7 +853,7 @@ if sys.version_info[:3] <= (3, 5, 1):
'test_httplib.BasicTest.test_readlines_content_length'
,
]
if
sys
.
version_info
[:
2
]
>=
(
3
,
6
)
:
if
PY36
:
disabled_tests
+=
[
'test_threading.MiscTestCase.test__all__'
,
]
...
...
src/greentest/greentest/sysinfo.py
View file @
664e34da
...
...
@@ -27,6 +27,7 @@ PYPY = hasattr(sys, 'pypy_version_info')
VERBOSE
=
sys
.
argv
.
count
(
'-v'
)
>
1
WIN
=
sys
.
platform
.
startswith
(
"win"
)
LINUX
=
sys
.
platform
.
startswith
(
'linux'
)
OSX
=
sys
.
platform
==
'darwin'
# XXX: Formalize this better
LIBUV
=
os
.
getenv
(
'GEVENT_CORE_CFFI_ONLY'
)
==
'libuv'
or
(
PYPY
and
WIN
)
or
hasattr
(
gevent
.
core
,
'libuv'
)
...
...
src/greentest/greentest/testcase.py
View file @
664e34da
...
...
@@ -32,7 +32,7 @@ from greentest import leakcheck
from
greentest
import
errorhandler
from
greentest
import
flaky
from
patched_tests_setup
import
get_switch_expected
from
greentest.
patched_tests_setup
import
get_switch_expected
...
...
src/greentest/test___monkey_patching.py
View file @
664e34da
...
...
@@ -50,7 +50,7 @@ def TESTRUNNER(tests=None):
if
tests
and
not
sys
.
platform
.
startswith
(
"win"
):
atexit
.
register
(
os
.
system
,
'rm -f */@test*'
)
basic_args
=
[
sys
.
executable
,
'-u'
,
'-W'
,
'ignore'
,
'-m'
'monkey_test'
]
basic_args
=
[
sys
.
executable
,
'-u'
,
'-W'
,
'ignore'
,
'-m'
'
greentest.
monkey_test'
]
for
filename
in
tests
:
if
filename
in
version_tests
:
util
.
log
(
"Overriding %s from %s with file from %s"
,
filename
,
directory
,
full_directory
)
...
...
@@ -65,7 +65,7 @@ def TESTRUNNER(tests=None):
def
main
():
import
testrunner
from
greentest
import
testrunner
return
testrunner
.
run_many
(
list
(
TESTRUNNER
(
sys
.
argv
[
1
:])))
...
...
src/greentest/test__event.py
View file @
664e34da
...
...
@@ -72,6 +72,8 @@ class TestAsyncResultGet(greentest.GenericGetTestCase):
def
wait
(
self
,
timeout
):
AsyncResult
().
get
(
timeout
=
timeout
)
class
MyException
(
Exception
):
pass
class
TestAsyncResult
(
greentest
.
TestCase
):
...
...
@@ -88,9 +90,6 @@ class TestAsyncResult(greentest.TestCase):
self
.
assertEqual
(
e
.
exc_info
,
())
self
.
assertEqual
(
e
.
exception
,
None
)
class
MyException
(
Exception
):
pass
def
waiter
():
with
self
.
assertRaises
(
MyException
)
as
exc
:
e
.
get
()
...
...
@@ -105,9 +104,6 @@ class TestAsyncResult(greentest.TestCase):
event1
=
AsyncResult
()
event2
=
AsyncResult
()
class
MyException
(
Exception
):
pass
timer_exc
=
MyException
(
'interrupted'
)
g
=
gevent
.
spawn_later
(
DELAY
/
2.0
,
event1
.
set
,
'hello event1'
)
...
...
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