Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

added --skip_to_end flag to pytest wind

Hugues Devimeux1ad7143cdd71
diff --git a/tests/conftest.py b/tests/conftest.py
index ffd0ff634..09788572b 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -9,8 +9,7 @@ import logging
class SceneTester:
- """Class used to test the animations.
- """
+ """Class used to test the animations."""
def __init__(self, scene_object, config_scene, module_tested, caching_needed=False):
# Disable the the logs, (--quiet is broken) TODO
@@ -51,7 +50,21 @@ class SceneTester:
assert(test_result), "The frames don't match. {} has been modified. Please ignore if it was intended".format(
str(self.scene).replace('Test', ''))
return 1
-
+
+def pytest_addoption(parser):
+ 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.")
+
+def pytest_configure(config):
+ config.addinivalue_line("markers", "skip_end_to_end: mark test as end_to_end test")
+
+def pytest_collection_modifyitems(config, items):
+ if config.getoption("--skip_end_to_end") == False:
+ return
+ else:
+ skip_end_to_end = pytest.mark.skip(reason="End to end test skipped due to --skip_end_to_end flag")
+ for item in items:
+ if "skip_end_to_end" in item.keywords:
+ item.add_marker(skip_end_to_end)
@pytest.fixture
def Tester():
diff --git a/tests/test_CLI.py b/tests/test_CLI.py
index 703cc9b2b..3c2da3410 100644
--- a/tests/test_CLI.py
+++ b/tests/test_CLI.py
@@ -1,6 +1,7 @@
import subprocess
import os
from shutil import rmtree
+import pytest
def capture(command):
@@ -19,6 +20,7 @@ def test_help(python_version):
err)
def test_basicScene(python_version):
""" Simulate SquareToCircle. The cache will be saved in tests_caches/media_temp (temporary directory). This is mainly intended to test the partial-movies process. """
path_basic_scene = os.path.join("tests", "tests_data", "basic_scenes.py")
@@ -31,7 +33,7 @@ def test_basicScene(python_version):
path_output, "videos", "basic_scenes", "480p15", "SquareToCircle.mp4")), err # "Error in the file generation. Please ignore if it was intended"
rmtree(path_output)
-
def test_WriteStuff(python_version):
"""Simulate WriteStuff. This is mainly intended to test the caching process of the tex objects"""
path_basic_scene = os.path.join("tests", "tests_data", "basic_scenes.py")