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
2a4e2c28
Commit
2a4e2c28
authored
Apr 09, 2019
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make zope.interface optional for tests too.
parent
3b630a0a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
8 deletions
+33
-8
src/gevent/testing/__init__.py
src/gevent/testing/__init__.py
+15
-0
src/gevent/testing/skipping.py
src/gevent/testing/skipping.py
+1
-1
src/gevent/tests/test___monitor.py
src/gevent/tests/test___monitor.py
+2
-3
src/gevent/tests/test__events.py
src/gevent/tests/test__events.py
+13
-2
src/gevent/tests/test__hub.py
src/gevent/tests/test__hub.py
+1
-1
src/gevent/tests/test__monkey.py
src/gevent/tests/test__monkey.py
+1
-1
No files found.
src/gevent/testing/__init__.py
View file @
2a4e2c28
...
...
@@ -145,3 +145,18 @@ except ImportError: # Python 2
return
unittest
.
skip
(
reason
)
mock
=
mock
# zope.interface
try
:
from
zope.interface
import
verify
except
ImportError
:
class
verify
(
object
):
@
staticmethod
def
verifyObject
(
*
_
):
import
warnings
warnings
.
warn
(
"zope.interface is not installed; not verifying"
)
return
verify
=
verify
src/gevent/testing/skipping.py
View file @
2a4e2c28
...
...
@@ -146,7 +146,7 @@ def skipWithoutPSUtil(reason):
# Python 2
pass
test_item
=
SkipWrapper
print
(
test_item
.
mro
())
return
test_item
return
decorator
...
...
src/gevent/tests/test___monitor.py
View file @
2a4e2c28
...
...
@@ -10,8 +10,8 @@ from greenlet import settrace
from
gevent.monkey
import
get_original
from
gevent._compat
import
thread_mod_name
from
gevent._compat
import
NativeStrIO
from
gevent._compat
import
get_this_psutil_process
from
gevent.testing
import
verify
from
gevent.testing.skipping
import
skipWithoutPSUtil
from
gevent
import
_monitor
as
monitor
...
...
@@ -247,7 +247,6 @@ class TestPeriodicMonitorBlocking(_AbstractTestPeriodicMonitoringThread,
# so nothing is considered blocked
from
gevent.events
import
subscribers
from
gevent.events
import
IEventLoopBlocked
from
zope.interface.verify
import
verifyObject
events
=
[]
subscribers
.
append
(
events
.
append
)
...
...
@@ -265,7 +264,7 @@ class TestPeriodicMonitorBlocking(_AbstractTestPeriodicMonitoringThread,
# Again without switching is a problem.
self
.
assertTrue
(
self
.
pmt
.
monitor_blocking
(
self
.
hub
))
self
.
assertTrue
(
events
)
verifyObject
(
IEventLoopBlocked
,
events
[
0
])
verify
.
verify
Object
(
IEventLoopBlocked
,
events
[
0
])
del
events
[:]
# But we can order it not to be a problem
...
...
src/gevent/tests/test__events.py
View file @
2a4e2c28
...
...
@@ -8,8 +8,19 @@ from __future__ import print_function
import
unittest
from
gevent
import
events
from
zope.interface
import
verify
try
:
from
zope.interface
import
verify
except
ImportError
:
verify
=
None
try
:
from
zope
import
event
except
ImportError
:
event
=
None
@
unittest
.
skipIf
(
verify
is
None
,
"Needs zope.interface"
)
class
TestImplements
(
unittest
.
TestCase
):
def
test_event_loop_blocked
(
self
):
...
...
@@ -28,10 +39,10 @@ class TestImplements(unittest.TestCase):
events
.
MemoryUsageUnderThreshold
(
0
,
0
,
0
,
0
))
@
unittest
.
skipIf
(
event
is
None
,
"Needs zope.event"
)
class
TestEvents
(
unittest
.
TestCase
):
def
test_is_zope
(
self
):
from
zope
import
event
self
.
assertIs
(
events
.
subscribers
,
event
.
subscribers
)
self
.
assertIs
(
events
.
notify
,
event
.
notify
)
...
...
src/gevent/tests/test__hub.py
View file @
2a4e2c28
...
...
@@ -329,7 +329,7 @@ class TestPeriodicMonitoringThread(greentest.TestCase):
class
TestLoopInterface
(
unittest
.
TestCase
):
def
test_implemensts_ILoop
(
self
):
from
zope.interface
import
verify
from
gevent.testing
import
verify
from
gevent._interfaces
import
ILoop
loop
=
get_hub
().
loop
...
...
src/gevent/tests/test__monkey.py
View file @
2a4e2c28
...
...
@@ -70,7 +70,7 @@ class TestMonkey(SubscriberCleanupMixin, unittest.TestCase):
def
test_patch_twice_warnings_events
(
self
):
import
warnings
from
zope.interface
import
verify
from
gevent.testing
import
verify
orig_saved
=
{}
for
k
,
v
in
monkey
.
saved
.
items
():
...
...
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