Acknowledge comments from the review, updated Gevent and Eventlet unit tests
This commit is contained in:
parent
6766d77b72
commit
d343aa53fd
|
@ -16,6 +16,7 @@ nosetests -s -v --with-ignore-docstrings --with-xunit --xunit-file=unit_results.
|
|||
$env:MONKEY_PATCH_LOOP=1
|
||||
nosetests -s -v --with-ignore-docstrings --with-xunit --xunit-file=unit_results.xml .\tests\unit\io\test_geventreactor.py
|
||||
nosetests -s -v --with-ignore-docstrings --with-xunit --xunit-file=unit_results.xml .\tests\unit\io\test_eventletreactor.py
|
||||
Remove-Item $env:MONKEY_PATCH_LOOP
|
||||
|
||||
echo "uploading unit results"
|
||||
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\unit_results.xml))
|
||||
|
|
|
@ -59,7 +59,7 @@ def is_monkey_patched():
|
|||
return is_gevent_monkey_patched() or is_eventlet_monkey_patched()
|
||||
|
||||
|
||||
MONKEY_PATCH_LOOP = bool(os.getenv('MONKEY_PATCH_LOOP', False) == "1")
|
||||
MONKEY_PATCH_LOOP = bool(os.getenv('MONKEY_PATCH_LOOP', False))
|
||||
|
||||
notwindows = unittest.skipUnless(not "Windows" in platform.system(), "This test is not adequate for windows")
|
||||
notpypy = unittest.skipUnless(not platform.python_implementation() == 'PyPy', "This tests is not suitable for pypy")
|
||||
|
|
|
@ -19,31 +19,29 @@ except ImportError:
|
|||
import unittest # noqa
|
||||
|
||||
from tests.unit.io.utils import TimerConnectionTests
|
||||
from tests.unit.io.eventlet_utils import restore_saved_module
|
||||
from tests import notpypy
|
||||
from tests import notmonkeypatch
|
||||
from tests import notpypy, MONKEY_PATCH_LOOP, notmonkeypatch
|
||||
|
||||
import time
|
||||
from eventlet import monkey_patch, kill
|
||||
from eventlet import monkey_patch
|
||||
|
||||
try:
|
||||
from cassandra.io.eventletreactor import EventletConnection
|
||||
except ImportError:
|
||||
EventletConnection = None # noqa
|
||||
|
||||
@unittest.skipUnless(EventletConnection is not None, "Skpping the eventlet tests because it's not installed")
|
||||
@notmonkeypatch
|
||||
# There are some issues with some versions of pypy and eventlet
|
||||
@notpypy
|
||||
@unittest.skipIf(EventletConnection is None, "Skpping the eventlet tests because it's not installed")
|
||||
@notmonkeypatch
|
||||
class EventletTimerTest(unittest.TestCase, TimerConnectionTests):
|
||||
|
||||
def setUp(self):
|
||||
self.connection_class = EventletConnection
|
||||
# We only to patch the time module
|
||||
monkey_patch(time=True)
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
# This is run even though the class is skipped, so we need
|
||||
# to make sure no monkey patching is happening
|
||||
if not MONKEY_PATCH_LOOP:
|
||||
return
|
||||
monkey_patch()
|
||||
cls.connection_class = EventletConnection
|
||||
EventletConnection.initialize_reactor()
|
||||
|
||||
def tearDown(self):
|
||||
kill(EventletConnection._timeout_watcher)
|
||||
EventletConnection._timers = None
|
||||
restore_saved_module(time)
|
||||
# There is no unpatching because there is not a clear way
|
||||
# of doing it reliably
|
||||
|
|
|
@ -19,24 +19,26 @@ except ImportError:
|
|||
|
||||
|
||||
from tests.unit.io.utils import TimerConnectionTests
|
||||
from tests import notmonkeypatch
|
||||
from tests import MONKEY_PATCH_LOOP, notmonkeypatch
|
||||
try:
|
||||
from cassandra.io.geventreactor import GeventConnection
|
||||
import gevent.monkey
|
||||
from tests.unit.io.gevent_utils import restore_saved_module
|
||||
except ImportError:
|
||||
GeventConnection = None # noqa
|
||||
|
||||
@unittest.skipUnless(GeventConnection is not None, "Skpping the gevent tests because it's not installed")
|
||||
|
||||
@unittest.skipIf(GeventConnection is None, "Skpping the gevent tests because it's not installed")
|
||||
@notmonkeypatch
|
||||
class GeventTimerTest(unittest.TestCase, TimerConnectionTests):
|
||||
|
||||
def setUp(self):
|
||||
self.connection_class = GeventConnection
|
||||
#We only to patch the time module
|
||||
gevent.monkey.patch_time()
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
# This is run even though the class is skipped, so we need
|
||||
# to make sure no monkey patching is happening
|
||||
if not MONKEY_PATCH_LOOP:
|
||||
return
|
||||
gevent.monkey.patch_all()
|
||||
cls.connection_class = GeventConnection
|
||||
GeventConnection.initialize_reactor()
|
||||
|
||||
def tearDown(self):
|
||||
restore_saved_module("time")
|
||||
GeventConnection._timers = None
|
||||
# There is no unpatching because there is not a clear way
|
||||
# of doing it reliably
|
||||
|
|
Loading…
Reference in New Issue