Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test samples on Windows #85

Merged
merged 1 commit into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
30 changes: 20 additions & 10 deletions test/test_samples.py
Original file line number Diff line number Diff line change
@@ -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")