Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Bugfix: Fixed the `-a` flag. (#1134)

Abel Aebker5f658bae2821
diff --git a/manim/scene/scene_file_writer.py b/manim/scene/scene_file_writer.py
index f10d0c049..fb694d722 100644
--- a/manim/scene/scene_file_writer.py
+++ b/manim/scene/scene_file_writer.py
@@ -68,7 +68,7 @@ class SceneFileWriter(object):
else:
module_name = ""
- if config["output_file"]:
+ if config["output_file"] and not config["write_all"]:
default_name = config.get_dir("output_file")
else:
default_name = Path(scene_name)
@@ -102,7 +102,7 @@ class SceneFileWriter(object):
self.partial_movie_directory = guarantee_existence(
config.get_dir(
"partial_movie_dir",
- scene_name=default_name,
+ scene_name=scene_name,
module_name=module_name,
)
)
diff --git a/tests/test_scene_rendering/conftest.py b/tests/test_scene_rendering/conftest.py
index b5b6f1d05..a09e9ca26 100644
--- a/tests/test_scene_rendering/conftest.py
+++ b/tests/test_scene_rendering/conftest.py
@@ -11,3 +11,8 @@ def manim_cfg_file():
@pytest.fixture
def simple_scenes_path():
return str(Path(__file__).parent / "simple_scenes.py")
+
+
+def infallible_scenes_path():
+ return str(Path(__file__).parent / "infallible_scenes.py")
diff --git a/tests/test_scene_rendering/infallible_scenes.py b/tests/test_scene_rendering/infallible_scenes.py
new file mode 100644
index 000000000..2a270a4cd
--- /dev/null
+++ b/tests/test_scene_rendering/infallible_scenes.py
@@ -0,0 +1,11 @@
+from manim import *
+
+
+class Wait1(Scene):
+ def construct(self):
+ self.wait()
+
+
+class Wait2(Scene):
+ def construct(self):
+ self.wait(2)
diff --git a/tests/test_scene_rendering/test_cli_flags.py b/tests/test_scene_rendering/test_cli_flags.py
index d01e1a18f..0d0483776 100644
--- a/tests/test_scene_rendering/test_cli_flags.py
+++ b/tests/test_scene_rendering/test_cli_flags.py
@@ -145,6 +145,34 @@ def test_r_flag(tmp_path, manim_cfg_file, simple_scenes_path):
assert np.asarray(Image.open(filename)).shape == (100, 200, 4)
+def test_a_flag(tmp_path, manim_cfg_file, infallible_scenes_path):
+ command = [
+ sys.executable,
+ "-m",
+ "manim",
+ infallible_scenes_path,
+ "-ql",
+ "--media_dir",
+ str(tmp_path),
+ "-a",
+ ]
+ out, err, exit_code = capture(command)
+ assert exit_code == 0, err
+
+ one_is_not_empty = (
+ tmp_path / "videos" / "infallible_scenes" / "480p15" / "Wait1.mp4"
+ ).is_file()
+ assert one_is_not_empty, "running manim with -a flag did not render the first scene"
+
+ two_is_not_empty = (
+ tmp_path / "videos" / "infallible_scenes" / "480p15" / "Wait2.mp4"
+ ).is_file()
+ assert (
+ two_is_not_empty
+ ), "running manim with -a flag did not render the second scene"
+
+
@pytest.mark.slow
def test_custom_folders(tmp_path, manim_cfg_file, simple_scenes_path):
scene_name = "SquareToCircle"