Skip to content

Commit 1506aa9

Browse files
committed
dont capture with pytest
1 parent 228ad81 commit 1506aa9

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

ipykernel/inprocess/tests/test_kernel.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ def test_stdout(self):
9999
out, err = assemble_output(kc.iopub_channel)
100100
assert out == 'bar\n'
101101

102-
@pytest.mark.skipif(
103-
sys.platform == 'win32',
104-
reason="not ment to work on windows"
102+
@pytest.mark.skip(
103+
reason="Currently don't capture during test as pytest does its own capturing"
105104
)
106105
def test_capfd(self):
107106
""" Does correctly capture fd

ipykernel/iostream.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from weakref import WeakSet
1515
import traceback
1616
from io import StringIO, TextIOBase
17+
import os
1718

1819
import zmq
1920
if zmq.pyzmq_version_info() >= (17, 0):
@@ -364,9 +365,13 @@ def __init__(
364365
self._new_buffer()
365366
self.echo = None
366367

367-
if watchfd and (
368-
sys.platform.startswith("linux") or sys.platform.startswith("darwin")
368+
if (
369+
watchfd
370+
and (sys.platform.startswith("linux") or sys.platform.startswith("darwin"))
371+
and ("PYTEST_CURRENT_TEST" not in os.environ)
369372
):
373+
# Pytest set its own capture. Dont redirect from within pytest.
374+
370375
self._should_watch = True
371376
self._setup_stream_redirects(name)
372377

ipykernel/tests/test_kernel.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ def test_simple_print():
5151
assert stderr == ''
5252
_check_master(kc, expected=True)
5353

54-
@pytest.mark.skipif(sys.platform=='win32', reason='Not meant to work on windows')
54+
55+
@pytest.mark.skip(
56+
reason="Currently don't capture during test as pytest does its own capturing"
57+
)
5558
def test_capture_fd():
5659
"""simple print statement in kernel"""
5760
with kernel() as kc:

0 commit comments

Comments
 (0)