From 15ceafba3ef769ca7e4b7a93df9eeccfad553139 Mon Sep 17 00:00:00 2001 From: Torbjorn Sorby Date: Tue, 14 Jul 2020 20:42:22 +0200 Subject: [PATCH] Test samples on Windows Resolves #82 Add samples that depend on physical camera --- test/conftest.py | 7 +------ test/test_samples.py | 30 ++++++++++++++++++++---------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index 78f851f4..6f158932 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -114,13 +114,8 @@ def __exit__(self, etype, value, traceback): @pytest.helpers.register def run_sample(name, working_directory=None): - current_working_directory = Path(os.getcwd()).resolve() sample = ( - current_working_directory - / ".." - / ".." - / "samples" - / "sample_{name}.py".format(name=name) + Path(__file__) / ".." / ".." / "samples" / "sample_{name}.py".format(name=name) ).resolve() if working_directory is not None: diff --git a/test/test_samples.py b/test/test_samples.py index 6688c3c1..f73b6402 100644 --- a/test/test_samples.py +++ b/test/test_samples.py @@ -1,21 +1,31 @@ -import platform - import pytest -@pytest.mark.skipif( - platform.system() == "Windows", - reason=r"python: can't open file 'D:\a\samples\sample_capture_from_file.py': [Errno 2] No such file or directory", -) def test_capture_from_file(sample_data_file): pytest.helpers.run_sample( name="capture_from_file", working_directory=sample_data_file.parent ) -@pytest.mark.skipif( - platform.system() == "Windows", - reason=r"python: can't open file 'D:\a\samples\sample_print_version_info.py': [Errno 2] No such file or directory", -) def test_print_version_info(): pytest.helpers.run_sample(name="print_version_info") + + +@pytest.mark.physical_camera +def test_capture(): + pytest.helpers.run_sample(name="capture") + + +@pytest.mark.physical_camera +def test_capture_2d(): + pytest.helpers.run_sample(name="capture_2d") + + +@pytest.mark.physical_camera +def test_capture_assistant(): + pytest.helpers.run_sample(name="capture_assistant") + + +@pytest.mark.physical_camera +def test_capture_hdr(): + pytest.helpers.run_sample(name="capture_hdr")