Skip to content

Commit 2c512f1

Browse files
Revert "Stop requiring pytest-subtests, it has been incorporated into pytest."
This reverts commit e97a3c1.
1 parent e97a3c1 commit 2c512f1

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

tests/test_contents.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@
88
import importlib_resources as resources
99

1010

11+
if sys.version_info < (3, 6):
12+
# pytest-subtests does not support Python < 3.6, but having the tests
13+
# separated into clean subtests is nice but not required, so we will create
14+
# a stub that does nothing but at least doesn't fail for lack of a fixture.
15+
import contextlib
16+
17+
class _SubTestStub:
18+
@contextlib.contextmanager
19+
def test(self, **kwargs):
20+
yield
21+
22+
_sub_test_stub = _SubTestStub()
23+
24+
@pytest.fixture
25+
def subtests():
26+
yield _sub_test_stub
27+
28+
1129
def get_magic(zone_name):
1230
components = zone_name.split("/")
1331
package_name = ".".join(["tzdata.zoneinfo"] + components[:-1])

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ skip_missing_interpreters = true
77
description = Test that the tzdata contents are accessible
88
deps =
99
pytest
10+
pytest-subtests; python_version>='3.6'
1011
importlib_resources; python_version<'3.7'
1112
commands =
1213
pytest {toxinidir} {posargs}

0 commit comments

Comments
 (0)