Skip to content

Commit b6f26e6

Browse files
committed
Support pytest 9
pytest 9 has included support for subtests, marking pytest_subtests as unmaintained at the same time -- attempt to import from pytest first, falling back to pytest_subtests if required.
1 parent 37cce29 commit b6f26e6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tests/functional/shell/test_script_subprocess.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
from typing import cast
99

1010
import pytest
11-
from pytest_subtests import SubTests
11+
try:
12+
from pytest import Subtests as SubTests
13+
except ImportError:
14+
from pytest_subtests import SubTests
1215

1316
from pytestshellutils.customtypes import EnvironDict
1417
from pytestshellutils.exceptions import FactoryTimeout

tests/unit/utils/processes/test_processresult.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
import textwrap
99

1010
import pytest
11-
from pytest_subtests import SubTests
11+
try:
12+
from pytest import Subtests as SubTests
13+
except ImportError:
14+
from pytest_subtests import SubTests
1215

1316
from pytestshellutils.utils.processes import ProcessResult
1417

0 commit comments

Comments
 (0)