Skip to content

Commit 4c21800

Browse files
authored
Replace @flaky.flaky decorate with pytest fixture (#1411)
Signed-off-by: Michał Górny <[email protected]>
1 parent 700b9b2 commit 4c21800

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

tests/inprocess/test_kernelmanager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import unittest
55

66
import pytest
7-
from flaky import flaky
87

98
from ipykernel.inprocess.manager import InProcessKernelManager
109

@@ -21,7 +20,7 @@ def tearDown(self):
2120
if self.km.has_kernel:
2221
self.km.shutdown_kernel()
2322

24-
@flaky
23+
@pytest.mark.flaky
2524
def test_interface(self):
2625
"""Does the in-process kernel manager implement the basic KM interface?"""
2726
km = self.km

tests/test_embed_kernel.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from subprocess import PIPE, Popen
1313

1414
import pytest
15-
from flaky import flaky
1615
from jupyter_client.blocking.client import BlockingKernelClient
1716
from jupyter_core import paths
1817

@@ -91,7 +90,7 @@ def connection_file_ready(connection_file):
9190
fid.close()
9291

9392

94-
@flaky(max_runs=3)
93+
@pytest.mark.flaky(max_runs=3)
9594
def test_embed_kernel_basic():
9695
"""IPython.embed_kernel() is basically functional"""
9796
cmd = "\n".join(
@@ -127,7 +126,7 @@ def test_embed_kernel_basic():
127126
assert "10" in text
128127

129128

130-
@flaky(max_runs=3)
129+
@pytest.mark.flaky(max_runs=3)
131130
def test_embed_kernel_namespace():
132131
"""IPython.embed_kernel() inherits calling namespace"""
133132
cmd = "\n".join(
@@ -166,7 +165,7 @@ def test_embed_kernel_namespace():
166165
assert not content["found"]
167166

168167

169-
@flaky(max_runs=3)
168+
@pytest.mark.flaky(max_runs=3)
170169
def test_embed_kernel_reentrant():
171170
"""IPython.embed_kernel() can be called multiple times"""
172171
cmd = "\n".join(

tests/test_kernel.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import IPython
1818
import psutil
1919
import pytest
20-
from flaky import flaky
2120
from IPython.paths import locate_profile
2221

2322
from .utils import (
@@ -212,7 +211,7 @@ def test_sys_path_profile_dir():
212211
assert "" in sys_path
213212

214213

215-
@flaky(max_runs=3)
214+
@pytest.mark.flaky(max_runs=3)
216215
@pytest.mark.skipif(
217216
sys.platform == "win32" or (sys.platform == "darwin"),
218217
reason="subprocess prints fail on Windows and MacOS Python 3.8+",
@@ -244,7 +243,7 @@ def test_subprocess_print():
244243
_check_master(kc, expected=True, stream="stderr")
245244

246245

247-
@flaky(max_runs=3)
246+
@pytest.mark.flaky(max_runs=3)
248247
def test_subprocess_noprint():
249248
"""mp.Process without print doesn't trigger iostream mp_mode"""
250249
with kernel() as kc:
@@ -267,7 +266,7 @@ def test_subprocess_noprint():
267266
_check_master(kc, expected=True, stream="stderr")
268267

269268

270-
@flaky(max_runs=3)
269+
@pytest.mark.flaky(max_runs=3)
271270
@pytest.mark.skipif(
272271
(sys.platform == "win32") or (sys.platform == "darwin"),
273272
reason="subprocess prints fail on Windows and MacOS Python 3.8+",

tests/test_start_kernel.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from textwrap import dedent
33

44
import pytest
5-
from flaky import flaky
65

76
from .test_embed_kernel import setup_kernel
87

@@ -12,7 +11,7 @@
1211
pytest.skip("skipping tests on windows", allow_module_level=True)
1312

1413

15-
@flaky(max_runs=3)
14+
@pytest.mark.flaky(max_runs=3)
1615
def test_ipython_start_kernel_userns():
1716
import IPython
1817

@@ -51,7 +50,7 @@ def test_ipython_start_kernel_userns():
5150
assert EXPECTED in text
5251

5352

54-
@flaky(max_runs=3)
53+
@pytest.mark.flaky(max_runs=3)
5554
def test_ipython_start_kernel_no_userns():
5655
# Issue #4188 - user_ns should be passed to shell as None, not {}
5756
cmd = dedent(

0 commit comments

Comments
 (0)