Skip to content

Commit 8e2a6a9

Browse files
committed
Removed MONKEY_PATCH_LOOP in tests
1 parent ad54008 commit 8e2a6a9

7 files changed

Lines changed: 25 additions & 17 deletions

File tree

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ script:
3333
exit 1
3434
fi
3535
- tox
36-
- tox -e patched_loops
36+
- tox -e gevent_loop
37+
- tox -e eventlet_loop

appveyor/run_test.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ if($env:ci_type -eq 'unit'){
1717
echo "Running Unit tests"
1818
nosetests -s -v --with-ignore-docstrings --with-xunit --xunit-file=unit_results.xml .\tests\unit
1919

20-
$env:MONKEY_PATCH_LOOP=1
20+
$env:EVENT_LOOP_MANAGER="gevent"
2121
nosetests -s -v --with-ignore-docstrings --with-xunit --xunit-file=unit_results.xml .\tests\unit\io\test_geventreactor.py
22+
$env:EVENT_LOOP_MANAGER="eventlet"
2223
nosetests -s -v --with-ignore-docstrings --with-xunit --xunit-file=unit_results.xml .\tests\unit\io\test_eventletreactor.py
23-
Remove-Item $env:MONKEY_PATCH_LOOP
24+
$env:EVENT_LOOP_MANAGER="asyncore"
2425

2526
echo "uploading unit results"
2627
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\unit_results.xml))

build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ build:
152152
# it takes too much time for the whole matrix to build with cython
153153
if [[ $CYTHON == 'CYTHON' ]]; then
154154
EVENT_LOOP_MANAGER=$EVENT_LOOP_MANAGER VERIFY_CYTHON=1 nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=unit_results.xml tests/unit/ || true
155-
MONKEY_PATCH_LOOP=$EVENT_LOOP_MANAGER EVENT_LOOP_MANAGER=$EVENT_LOOP_MANAGER VERIFY_CYTHON=1 nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=unit_eventlet_results.xml tests/unit/io/test_eventletreactor.py || true
156-
MONKEY_PATCH_LOOP=$EVENT_LOOP_MANAGER EVENT_LOOP_MANAGER=$EVENT_LOOP_MANAGER VERIFY_CYTHON=1 nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=unit_gevent_results.xml tests/unit/io/test_geventreactor.py || true
155+
EVENT_LOOP_MANAGER=eventlet VERIFY_CYTHON=1 nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=unit_eventlet_results.xml tests/unit/io/test_eventletreactor.py || true
156+
EVENT_LOOP_MANAGER=gevent VERIFY_CYTHON=1 nosetests -s -v --logging-format="[%(levelname)s] %(asctime)s %(thread)d: %(message)s" --with-ignore-docstrings --with-xunit --xunit-file=unit_gevent_results.xml tests/unit/io/test_geventreactor.py || true
157157
158158
fi
159159

tests/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,5 @@ def is_monkey_patched():
8989
connection_class = None
9090

9191

92-
MONKEY_PATCH_LOOP = os.getenv('MONKEY_PATCH_LOOP', False)
93-
9492
notwindows = unittest.skipUnless(not "Windows" in platform.system(), "This test is not adequate for windows")
9593
notpypy = unittest.skipUnless(not platform.python_implementation() == 'PyPy', "This tests is not suitable for pypy")
96-
notmonkeypatch = unittest.skipUnless(MONKEY_PATCH_LOOP, "Skipping this test because monkey patching is required")

tests/unit/io/test_eventletreactor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import unittest # noqa
2020

2121
from tests.unit.io.utils import TimerTestMixin
22-
from tests import notpypy, MONKEY_PATCH_LOOP, notmonkeypatch
22+
from tests import notpypy, EVENT_LOOP_MANAGER
2323

2424
from eventlet import monkey_patch
2525
from mock import patch
@@ -29,11 +29,10 @@
2929
except ImportError:
3030
EventletConnection = None # noqa
3131

32-
skip_condition = EventletConnection is None or MONKEY_PATCH_LOOP != "eventlet"
32+
skip_condition = EventletConnection is None or EVENT_LOOP_MANAGER != "eventlet"
3333
# There are some issues with some versions of pypy and eventlet
3434
@notpypy
3535
@unittest.skipIf(skip_condition, "Skipping the eventlet tests because it's not installed")
36-
@notmonkeypatch
3736
class EventletTimerTest(TimerTestMixin, unittest.TestCase):
3837

3938
connection_class = EventletConnection

tests/unit/io/test_geventreactor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
from tests.unit.io.utils import TimerTestMixin
22-
from tests import MONKEY_PATCH_LOOP, notmonkeypatch
22+
from tests import EVENT_LOOP_MANAGER
2323
try:
2424
from cassandra.io.geventreactor import GeventConnection
2525
import gevent.monkey
@@ -29,9 +29,8 @@
2929
from mock import patch
3030

3131

32-
skip_condition = GeventConnection is None or MONKEY_PATCH_LOOP != "gevent"
32+
skip_condition = GeventConnection is None or EVENT_LOOP_MANAGER != "gevent"
3333
@unittest.skipIf(skip_condition, "Skipping the gevent tests because it's not installed")
34-
@notmonkeypatch
3534
class GeventTimerTest(TimerTestMixin, unittest.TestCase):
3635

3736
connection_class = GeventConnection

tox.ini

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,25 @@ changedir = {envtmpdir}
2020
commands = nosetests --verbosity=2 --no-path-adjustment {toxinidir}/tests/unit/
2121

2222

23-
[testenv:patched_loops]
23+
[testenv:gevent_loop]
2424
deps = {[base]deps}
2525
gevent
2626

2727
setenv = LIBEV_EMBED=0
2828
CARES_EMBED=0
29-
MONKEY_PATCH_LOOP=1
29+
EVENT_LOOP_MANAGER=gevent
3030
changedir = {envtmpdir}
3131
commands =
32-
nosetests --verbosity=2 --no-path-adjustment {toxinidir}/tests/unit/io/test_eventletreactor.py
3332
nosetests --verbosity=2 --no-path-adjustment {toxinidir}/tests/unit/io/test_geventreactor.py
33+
34+
35+
[testenv:eventlet_loop]
36+
deps = {[base]deps}
37+
gevent
38+
39+
setenv = LIBEV_EMBED=0
40+
CARES_EMBED=0
41+
EVENT_LOOP_MANAGER=eventlet
42+
changedir = {envtmpdir}
43+
commands =
44+
nosetests --verbosity=2 --no-path-adjustment {toxinidir}/tests/unit/io/test_eventletreactor.py

0 commit comments

Comments
 (0)