Files
deb-python-eventlet/tests/greenpipe_test_with_statement.py
Sergey Shepelev 2da62a16c3 PEP-8 fixes, tox runs pep8 check
For now, pep8 check is only run for some files known to be clean,
we should clean the rest and enable pep8 check for all files then.
2014-04-23 15:15:22 +04:00

26 lines
521 B
Python

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