Moved GreenPipe context unit test into separate file. Skip that test in Python versions less than 2.5

This commit is contained in:
Scott Robinson
2010-03-04 17:27:19 -06:00
parent f52381655b
commit 0e69e72d3c
3 changed files with 29 additions and 21 deletions

View File

@@ -483,26 +483,6 @@ class TestGreenIo(LimitedTestCase):
gt.wait()
def test_pipe_context(self):
# ensure using a pipe as a context actually closes it.
r, w = os.pipe()
r = os.fdopen(r)
w = os.fdopen(w, 'w')
r = greenio.GreenPipe(r)
w = greenio.GreenPipe(w)
with r:
pass
assert r.closed and not w.closed
with w as f:
assert f == w
assert r.closed and w.closed
class TestGreenIoLong(LimitedTestCase):
TEST_TIMEOUT=10 # the test here might take a while depending on the OS

View File

@@ -0,0 +1,28 @@
from __future__ import with_statement
import os
from tests import LimitedTestCase
from eventlet import greenio
class TestGreenPipeWithStatement(LimitedTestCase):
def test_pipe_context(self):
# ensure using a pipe as a context actually closes it.
r, w = os.pipe()
r = os.fdopen(r)
w = os.fdopen(w, 'w')
r = greenio.GreenPipe(r)
w = greenio.GreenPipe(w)
with r:
pass
assert r.closed and not w.closed
with w as f:
assert f == w
assert r.closed and w.closed

View File

@@ -10,7 +10,7 @@ if parent_dir not in sys.path:
# hacky hacks: skip test__api_timeout when under 2.4 because otherwise it SyntaxErrors
if sys.version_info < (2,5):
argv = sys.argv + ["--exclude=.*timeout_test_with_statement.*"]
argv = sys.argv + ["--exclude=.*_with_statement.*"]
else:
argv = sys.argv