Skip to content

Commit 56e532a

Browse files
committed
Add fix for pytest>=4, remove invalid number of WCC in Z2 tests.
1 parent 4b34d19 commit 56e532a

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

tests/conftest.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@ def pytest_configure(config): # pylint: disable=missing-docstring
4040

4141

4242
def pytest_runtest_setup(item): # pylint: disable=missing-docstring
43-
abinit_marker = item.get_marker("abinit")
44-
vasp_marker = item.get_marker("vasp")
45-
qe_marker = item.get_marker("qe")
43+
try:
44+
abinit_marker = item.get_marker("abinit")
45+
vasp_marker = item.get_marker("vasp")
46+
qe_marker = item.get_marker("qe")
47+
except AttributeError: # for pytest>=4
48+
abinit_marker = item.get_closest_marker("abinit")
49+
vasp_marker = item.get_closest_marker("vasp")
50+
qe_marker = item.get_closest_marker("qe")
4651
if abinit_marker is not None:
4752
if not item.config.getoption("-A"):
4853
pytest.skip("test runs only with ABINIT")

tests/test_z2_invariant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def num_lines(request):
1414
return request.param
1515

1616

17-
@pytest.fixture(params=range(1, 20))
17+
@pytest.fixture(params=range(2, 20, 2))
1818
def num_wcc(request):
1919
return request.param
2020

0 commit comments

Comments
 (0)