Skip to content

Commit 1c93dfc

Browse files
mgornyianthomas23
authored andcommitted
Replace @flaky.flaky decorate with pytest fixture (#1411)
Signed-off-by: Michał Górny <mgorny@gentoo.org>
1 parent 81587cc commit 1c93dfc

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 (
@@ -210,7 +209,7 @@ def test_sys_path_profile_dir():
210209
assert "" in sys_path
211210

212211

213-
@flaky(max_runs=3)
212+
@pytest.mark.flaky(max_runs=3)
214213
@pytest.mark.skipif(
215214
sys.platform == "win32" or (sys.platform == "darwin" and sys.version_info >= (3, 8)),
216215
reason="subprocess prints fail on Windows and MacOS Python 3.8+",
@@ -242,7 +241,7 @@ def test_subprocess_print():
242241
_check_master(kc, expected=True, stream="stderr")
243242

244243

245-
@flaky(max_runs=3)
244+
@pytest.mark.flaky(max_runs=3)
246245
def test_subprocess_noprint():
247246
"""mp.Process without print doesn't trigger iostream mp_mode"""
248247
with kernel() as kc:
@@ -265,7 +264,7 @@ def test_subprocess_noprint():
265264
_check_master(kc, expected=True, stream="stderr")
266265

267266

268-
@flaky(max_runs=3)
267+
@pytest.mark.flaky(max_runs=3)
269268
@pytest.mark.skipif(
270269
sys.platform == "win32" or (sys.platform == "darwin" and sys.version_info >= (3, 8)),
271270
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)