Skip to content

Commit f9028c2

Browse files
authored
Only run imagehash tests on Linux machines (#4039)
1 parent 61fa04e commit f9028c2

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ env =
1515
log_level = WARNING
1616
markers =
1717
installation: test requires installation of dependencies
18+
diagnostic_image_output: test produces images that will be compared with imagehash
1819

1920
[coverage:run]
2021
parallel = true

tests/conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
"""Configure pytest."""
22

3+
import sys
4+
5+
import pytest
6+
37

48
def pytest_addoption(parser):
59
"""Add option to save imagehashes (used for diagnostic tests)."""
610
parser.addoption("--save_imagehashes")
11+
12+
13+
def pytest_runtest_setup(item):
14+
"""Only run diagnostic tests that produce images on Linux machines."""
15+
if item.get_closest_marker("diagnostic_image_output") is not None:
16+
platform = sys.platform
17+
if platform != "linux":
18+
pytest.skip(
19+
f"Diagnostic tests that produce images are not supported on "
20+
f"platform {platform}"
21+
)

0 commit comments

Comments
 (0)