Skip to content

Commit 1ad7143

Browse files
added --skip_to_end flag to pytest wind
1 parent 014dbb0 commit 1ad7143

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

tests/conftest.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010

1111
class SceneTester:
12-
"""Class used to test the animations.
13-
"""
12+
"""Class used to test the animations."""
1413

1514
def __init__(self, scene_object, config_scene, module_tested, caching_needed=False):
1615
# Disable the the logs, (--quiet is broken) TODO
@@ -51,7 +50,21 @@ def test(self):
5150
assert(test_result), "The frames don't match. {} has been modified. Please ignore if it was intended".format(
5251
str(self.scene).replace('Test', ''))
5352
return 1
54-
53+
54+
def pytest_addoption(parser):
55+
parser.addoption("--skip_end_to_end", action="store_true", default=False, help = "Will skip all the end-to-end tests. Useful when ffmpeg is not installed.")
56+
57+
def pytest_configure(config):
58+
config.addinivalue_line("markers", "skip_end_to_end: mark test as end_to_end test")
59+
60+
def pytest_collection_modifyitems(config, items):
61+
if config.getoption("--skip_end_to_end") == False:
62+
return
63+
else:
64+
skip_end_to_end = pytest.mark.skip(reason="End to end test skipped due to --skip_end_to_end flag")
65+
for item in items:
66+
if "skip_end_to_end" in item.keywords:
67+
item.add_marker(skip_end_to_end)
5568

5669
@pytest.fixture
5770
def Tester():

tests/test_CLI.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import subprocess
22
import os
33
from shutil import rmtree
4+
import pytest
45

56

67
def capture(command):
@@ -19,6 +20,7 @@ def test_help(python_version):
1920
err)
2021

2122

23+
@pytest.mark.skip_end_to_end
2224
def test_basicScene(python_version):
2325
""" Simulate SquareToCircle. The cache will be saved in tests_caches/media_temp (temporary directory). This is mainly intended to test the partial-movies process. """
2426
path_basic_scene = os.path.join("tests", "tests_data", "basic_scenes.py")
@@ -31,7 +33,7 @@ def test_basicScene(python_version):
3133
path_output, "videos", "basic_scenes", "480p15", "SquareToCircle.mp4")), err # "Error in the file generation. Please ignore if it was intended"
3234
rmtree(path_output)
3335

34-
36+
@pytest.mark.skip_end_to_end
3537
def test_WriteStuff(python_version):
3638
"""Simulate WriteStuff. This is mainly intended to test the caching process of the tex objects"""
3739
path_basic_scene = os.path.join("tests", "tests_data", "basic_scenes.py")

0 commit comments

Comments
 (0)