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
38ba3804
Commit
38ba3804
authored
Jan 06, 2020
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workaround Travis having too old a kernel to use the linux AIO backend.
parent
3f6af410
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
13 deletions
+42
-13
src/gevent/testing/sysinfo.py
src/gevent/testing/sysinfo.py
+10
-0
src/gevent/tests/test__close_backend_fd.py
src/gevent/tests/test__close_backend_fd.py
+32
-13
No files found.
src/gevent/testing/sysinfo.py
View file @
38ba3804
...
...
@@ -154,3 +154,13 @@ def get_python_version():
version
+=
'b%s'
%
sys
.
version_info
[
4
]
return
version
def
libev_supports_linux_aio
():
# libev requires kernel 4.19 or above to be able to support
# linux AIO. It can still be compiled in, but will fail to create
# the loop at runtime.
from
distutils.version
import
LooseVersion
from
platform
import
system
from
platform
import
release
return
system
==
'Linux'
and
LooseVersion
(
release
()
or
'0'
)
>=
LooseVersion
(
'4.19'
)
src/gevent/tests/test__close_backend_fd.py
View file @
38ba3804
...
...
@@ -6,6 +6,8 @@ import gevent
from
gevent
import
core
from
gevent.hub
import
Hub
from
gevent.testing
import
sysinfo
@
unittest
.
skipUnless
(
getattr
(
core
,
'LIBEV_EMBED'
,
False
),
"Needs embedded libev. "
...
...
@@ -29,15 +31,26 @@ class Test(unittest.TestCase):
'linux_iouring'
,
)
BACKENDS_THAT_WILL_FAIL_TO_CREATE_AT_RUNTIME
=
(
# This can be compiled on any (?) version of
# linux, but there's a runtime check that you're
# running at least kernel 4.19, so we can fail to create
# the hub. When we updated to libev 4.31 from 4.25, Travis Ci
# was still on kernel 1.15 (Ubunto 16.04).
'linux_aio'
,
)
if
not
sysinfo
.
libev_supports_linux_aio
()
else
(
)
def
_check_backend
(
self
,
backend
):
hub
=
Hub
(
backend
,
default
=
False
)
try
:
self
.
assertEqual
(
hub
.
loop
.
backend
,
backend
)
gevent
.
sleep
(
0.001
)
fileno
=
hub
.
loop
.
fileno
()
if
fileno
is
None
:
r
aise
unittest
.
SkipTest
(
"backend %s lacks fileno"
%
(
backend
,))
r
eturn
# nothing to close, test implicitly passes.
os
.
close
(
fileno
)
...
...
@@ -53,23 +66,29 @@ class Test(unittest.TestCase):
if
hub
.
loop
is
not
None
:
hub
.
destroy
()
def
_make_test
(
count
,
backend
):
# pylint:disable=no-self-argument
def
test
(
self
):
self
.
_check_backend
(
backend
)
@
classmethod
def
_make_test
(
cls
,
count
,
backend
):
# pylint:disable=no-self-argument
if
backend
in
cls
.
BACKENDS_THAT_WILL_FAIL_TO_CREATE_AT_RUNTIME
:
def
test
(
self
):
with
self
.
assertRaisesRegex
(
SystemError
,
'ev_loop_new'
):
Hub
(
backend
,
default
=
False
)
else
:
def
test
(
self
):
self
.
_check_backend
(
backend
)
test
.
__name__
=
'test_'
+
backend
+
'_'
+
str
(
count
)
return
test
.
__name__
,
test
count
=
backend
=
None
@
classmethod
def
_make_tests
(
cls
):
count
=
backend
=
None
for
count
in
range
(
2
):
for
backend
in
core
.
supported_backends
():
name
,
func
=
_make_test
(
count
,
backend
)
locals
()[
name
]
=
func
name
=
func
=
None
for
count
in
range
(
2
):
for
backend
in
core
.
supported_backends
():
name
,
func
=
cls
.
_make_test
(
count
,
backend
)
setattr
(
cls
,
name
,
func
)
name
=
func
=
None
del
count
del
backend
del
_make_test
Test
.
_make_tests
()
if
__name__
==
'__main__'
:
unittest
.
main
()
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