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
c55bec14
Commit
c55bec14
authored
Jun 08, 2022
by
Petr Viktorin
Committed by
Jason Madden
Oct 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Amend tests for Python 3.11: No more U file mode, no more inspect.getargspec()
parent
3fe70aca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
8 deletions
+23
-8
src/gevent/testing/testcase.py
src/gevent/testing/testcase.py
+10
-5
src/gevent/tests/test__fileobject.py
src/gevent/tests/test__fileobject.py
+13
-3
No files found.
src/gevent/testing/testcase.py
View file @
c55bec14
...
...
@@ -383,6 +383,7 @@ class TestCase(TestCaseMetaClass("NewBase",
return
error
def
assertMonkeyPatchedFuncSignatures
(
self
,
mod_name
,
func_names
=
(),
exclude
=
()):
# If inspect.getfullargspec is not available,
# We use inspect.getargspec because it's the only thing available
# in Python 2.7, but it is deprecated
# pylint:disable=deprecated-method,too-many-locals
...
...
@@ -409,9 +410,13 @@ class TestCase(TestCaseMetaClass("NewBase",
try
:
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
"ignore"
)
gevent_sig
=
inspect
.
getargspec
(
gevent_func
)
sig
=
inspect
.
getargspec
(
func
)
try
:
getfullargspec
=
inspect
.
getfullargspec
except
AttributeError
:
warnings
.
simplefilter
(
"ignore"
)
getfullargspec
=
inspect
.
getargspec
gevent_sig
=
getfullargspec
(
gevent_func
)
sig
=
getfullargspec
(
func
)
except
TypeError
:
if
funcs_given
:
raise
...
...
@@ -420,10 +425,10 @@ class TestCase(TestCaseMetaClass("NewBase",
# Python 3 can check a lot more than Python 2 can.
continue
self
.
assertEqual
(
sig
.
args
,
gevent_sig
.
args
,
func_name
)
# The next t
hree
might not actually matter?
# The next t
wo
might not actually matter?
self
.
assertEqual
(
sig
.
varargs
,
gevent_sig
.
varargs
,
func_name
)
self
.
assertEqual
(
sig
.
keywords
,
gevent_sig
.
keywords
,
func_name
)
self
.
assertEqual
(
sig
.
defaults
,
gevent_sig
.
defaults
,
func_name
)
# Should deal with others: https://docs.python.org/3/library/inspect.html#inspect.getfullargspec
def
assertEqualFlakyRaceCondition
(
self
,
a
,
b
):
try
:
...
...
src/gevent/tests/test__fileobject.py
View file @
c55bec14
...
...
@@ -200,6 +200,8 @@ class TestFileObjectBlock(CleanupMixin,
@
skipUnlessWorksWithRegularFiles
def
test_rbU_produces_bytes_readline
(
self
):
if
sys
.
version_info
>
(
3
,
11
):
self
.
skipTest
(
"U file mode was removed in 3.11"
)
# Including U in rb still produces bytes.
# Note that the universal newline behaviour is
# essentially ignored in explicit bytes mode.
...
...
@@ -213,6 +215,8 @@ class TestFileObjectBlock(CleanupMixin,
@
skipUnlessWorksWithRegularFiles
def
test_rU_produces_native
(
self
):
if
sys
.
version_info
>
(
3
,
11
):
self
.
skipTest
(
"U file mode was removed in 3.11"
)
gevent_data
=
self
.
__check_native_matches
(
b'line1
\
n
line2
\
r
\
n
line3
\
r
lastline
\
n
\
n
'
,
'rU'
,
...
...
@@ -362,9 +366,15 @@ class ConcurrentFileObjectMixin(object):
try
:
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
'ignore'
,
DeprecationWarning
)
# U is deprecated in Python 3, shows up on FileObjectThread
fobj
=
self
.
_makeOne
(
r
,
'rU'
)
if
sys
.
version_info
>
(
3
,
11
):
# U is removed in Python 3.11
mode
=
'r'
self
.
skipTest
(
"U file mode was removed in 3.11"
)
else
:
# U is deprecated in Python 3, shows up on FileObjectThread
warnings
.
simplefilter
(
'ignore'
,
DeprecationWarning
)
mode
=
'rU'
fobj
=
self
.
_makeOne
(
r
,
mode
)
result
=
fobj
.
read
()
fobj
.
close
()
self
.
assertEqual
(
'line1
\
n
line2
\
n
line3
\
n
line4
\
n
line5
\
n
line6'
,
result
)
...
...
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