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
762b758d
Commit
762b758d
authored
Oct 21, 2016
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test__timeout.py under PyPy3 by allowing its spelling of the type error.
parent
8f0924ee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
src/greentest/test__timeout.py
src/greentest/test__timeout.py
+7
-4
No files found.
src/greentest/test__timeout.py
View file @
762b758d
...
@@ -63,6 +63,10 @@ class Test(greentest.TestCase):
...
@@ -63,6 +63,10 @@ class Test(greentest.TestCase):
ex
=
self
.
_check_expires
(
timeout
)
ex
=
self
.
_check_expires
(
timeout
)
self
.
assertTrue
(
str
(
ex
).
endswith
(
'XXX'
))
self
.
assertTrue
(
str
(
ex
).
endswith
(
'XXX'
))
def
assert_type_err
(
self
,
ex
):
# PyPy3 uses 'exceptions must derive', everyone else uses "exceptions must be"
self
.
assertTrue
(
"exceptions must be"
in
str
(
ex
)
or
"exceptions must derive"
in
str
(
ex
),
str
(
ex
))
def
test_expires_non_exception
(
self
):
def
test_expires_non_exception
(
self
):
timeout
=
gevent
.
Timeout
(
SHOULD_EXPIRE
,
object
())
timeout
=
gevent
.
Timeout
(
SHOULD_EXPIRE
,
object
())
timeout
.
start
()
timeout
.
start
()
...
@@ -70,8 +74,7 @@ class Test(greentest.TestCase):
...
@@ -70,8 +74,7 @@ class Test(greentest.TestCase):
get_hub
().
switch
()
get_hub
().
switch
()
self
.
fail
(
"Most raise TypeError"
)
self
.
fail
(
"Most raise TypeError"
)
except
TypeError
as
ex
:
except
TypeError
as
ex
:
self
.
assertTrue
(
"exceptions must be"
in
str
(
ex
),
str
(
ex
))
self
.
assert_type_err
(
ex
)
timeout
.
cancel
()
timeout
.
cancel
()
class
OldStyle
:
class
OldStyle
:
...
@@ -83,7 +86,7 @@ class Test(greentest.TestCase):
...
@@ -83,7 +86,7 @@ class Test(greentest.TestCase):
self
.
fail
(
"Must raise OldStyle"
)
self
.
fail
(
"Must raise OldStyle"
)
except
TypeError
as
ex
:
except
TypeError
as
ex
:
self
.
assertTrue
(
greentest
.
PY3
,
"Py3 raises a TypeError for non-BaseExceptions"
)
self
.
assertTrue
(
greentest
.
PY3
,
"Py3 raises a TypeError for non-BaseExceptions"
)
self
.
assert
True
(
"exceptions must be"
in
str
(
ex
),
str
(
ex
)
)
self
.
assert
_type_err
(
ex
)
except
:
except
:
self
.
assertTrue
(
greentest
.
PY2
,
"Old style classes can only be raised on Py2"
)
self
.
assertTrue
(
greentest
.
PY2
,
"Old style classes can only be raised on Py2"
)
t
=
sys
.
exc_info
()[
0
]
t
=
sys
.
exc_info
()[
0
]
...
@@ -97,7 +100,7 @@ class Test(greentest.TestCase):
...
@@ -97,7 +100,7 @@ class Test(greentest.TestCase):
self
.
fail
(
"Must raise OldStyle"
)
self
.
fail
(
"Must raise OldStyle"
)
except
TypeError
as
ex
:
except
TypeError
as
ex
:
self
.
assertTrue
(
greentest
.
PY3
,
"Py3 raises a TypeError for non-BaseExceptions"
)
self
.
assertTrue
(
greentest
.
PY3
,
"Py3 raises a TypeError for non-BaseExceptions"
)
self
.
assert
True
(
"exceptions must be"
in
str
(
ex
),
str
(
ex
)
)
self
.
assert
_type_err
(
ex
)
except
:
except
:
self
.
assertTrue
(
greentest
.
PY2
,
"Old style classes can only be raised on Py2"
)
self
.
assertTrue
(
greentest
.
PY2
,
"Old style classes can only be raised on Py2"
)
t
=
sys
.
exc_info
()[
0
]
t
=
sys
.
exc_info
()[
0
]
...
...
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