Skip to content

Commit 8145bd5

Browse files
committed
Refactor and extend skipif.
1 parent 20fc10f commit 8145bd5

File tree

5 files changed

+16
-30
lines changed

5 files changed

+16
-30
lines changed

tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,10 @@ def pytest_collection_modifyitems(session, config, items) -> None: # noqa: ARG0
7979
for item in items:
8080
if isinstance(item, NotebookItem):
8181
item.add_marker(pytest.mark.xfail(reason="The tests are flaky."))
82+
83+
84+
skip_if_deadlock = pytest.mark.skipif(
85+
(sys.version_info[:2] in [(3, 12), (3, 13)] and sys.platform == "win32")
86+
or (sys.version_info[:2] == (3, 13) and sys.platform == "linux"),
87+
reason="Deadlock in loky/backend/resource_tracker.py, line 181, maybe related to https://github.com/joblib/loky/pull/450",
88+
)

tests/test_capture.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import sys
21
import textwrap
32

43
import pytest
54
from pytask import ExitCode
65
from pytask import cli
76

87
from pytask_parallel import ParallelBackend
8+
from tests.conftest import skip_if_deadlock
99

1010

1111
@pytest.mark.parametrize(
@@ -17,14 +17,7 @@
1717
reason="dask cannot handle dynamically imported modules."
1818
),
1919
),
20-
pytest.param(
21-
ParallelBackend.LOKY,
22-
marks=pytest.mark.skipif(
23-
(sys.version_info[:2] == (3, 12) and sys.platform == "win32")
24-
or (sys.version_info[:2] == (3, 13) and sys.platform == "linux"),
25-
reason="Deadlock in loky/backend/resource_tracker.py, line 181, maybe related to https://github.com/joblib/loky/pull/450", # noqa: E501
26-
),
27-
),
20+
pytest.param(ParallelBackend.LOKY, marks=skip_if_deadlock),
2821
ParallelBackend.PROCESSES,
2922
],
3023
)

tests/test_config.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from __future__ import annotations
22

33
import os
4-
import sys
54
import textwrap
65

76
import pytest
87
from pytask import ExitCode
98
from pytask import build
109

1110
from pytask_parallel import ParallelBackend
11+
from tests.conftest import skip_if_deadlock
1212

1313

1414
@pytest.mark.parametrize(
@@ -37,11 +37,7 @@ def test_interplay_between_debugging_and_parallel(tmp_path, pdb, n_workers, expe
3737
"parallel_backend",
3838
ParallelBackend.LOKY,
3939
ExitCode.OK,
40-
marks=pytest.mark.skipif(
41-
(sys.version_info[:2] == (3, 12) and sys.platform == "win32")
42-
or (sys.version_info[:2] == (3, 13) and sys.platform == "linux"),
43-
reason="Deadlock in loky/backend/resource_tracker.py, line 181, maybe related to https://github.com/joblib/loky/pull/450", # noqa: E501
44-
),
40+
marks=skip_if_deadlock,
4541
),
4642
("parallel_backend", ParallelBackend.PROCESSES, ExitCode.OK),
4743
("parallel_backend", ParallelBackend.THREADS, ExitCode.OK),

tests/test_execute.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import sys
43
import textwrap
54
from time import time
65

@@ -12,6 +11,7 @@
1211
from pytask_parallel import ParallelBackend
1312
from pytask_parallel.execute import _Sleeper
1413
from tests.conftest import restore_sys_path_and_module_after_test_execution
14+
from tests.conftest import skip_if_deadlock
1515

1616
_IMPLEMENTED_BACKENDS = [
1717
pytest.param(
@@ -20,14 +20,7 @@
2020
reason="dask cannot handle dynamically imported modules."
2121
),
2222
),
23-
pytest.param(
24-
ParallelBackend.LOKY,
25-
marks=pytest.mark.skipif(
26-
(sys.version_info[:2] == (3, 12) and sys.platform == "win32")
27-
or (sys.version_info[:2] == (3, 13) and sys.platform == "linux"),
28-
reason="Deadlock in loky/backend/resource_tracker.py, line 181, maybe related to https://github.com/joblib/loky/pull/450", # noqa: E501
29-
),
30-
),
23+
pytest.param(ParallelBackend.LOKY, marks=skip_if_deadlock),
3124
ParallelBackend.PROCESSES,
3225
ParallelBackend.THREADS,
3326
]

tests/test_remote.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import pickle
2-
import sys
32
import textwrap
43

54
import pytest
65
from pytask import ExitCode
76
from pytask import cli
87

9-
pytestmark = pytest.mark.skipif(
10-
(sys.version_info[:2] == (3, 12) and sys.platform == "win32")
11-
or (sys.version_info[:2] == (3, 13) and sys.platform == "linux"),
12-
reason="Deadlock in loky/backend/resource_tracker.py, line 181, maybe related to https://github.com/joblib/loky/pull/450",
13-
)
8+
from tests.conftest import skip_if_deadlock
9+
10+
pytestmark = skip_if_deadlock
1411

1512

1613
@pytest.fixture(autouse=True)

0 commit comments

Comments
 (0)