Acknowledge comments from the review, updated Gevent and Eventlet unit tests

This commit is contained in:
bjmb 2017-04-14 15:06:44 -04:00
parent 6766d77b72
commit d343aa53fd
5 changed files with 29 additions and 29 deletions

View File

@ -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))

View File

@ -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")

View File

@ -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

View File

@ -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

View File

@ -16,7 +16,6 @@ deps = {[base]deps}
setenv = LIBEV_EMBED=0
CARES_EMBED=0
MONKEY_PATCH_LOOP=0
changedir = {envtmpdir}
commands = nosetests --verbosity=2 --no-path-adjustment {toxinidir}/tests/unit/