Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

special handling of dry_run and delete unnecessary file

leotrs91587d12d687
diff --git a/manim/config/utils.py b/manim/config/utils.py
index 9ec35fdd2..68701115a 100644
--- a/manim/config/utils.py
+++ b/manim/config/utils.py
@@ -305,7 +305,7 @@ class ManimConfig(MutableMapping):
"transparent",
"scene_names",
"verbosity",
- "dry_run", # always set this one last
+
]:
if hasattr(args, key):
attr = getattr(args, key)
@@ -314,9 +314,13 @@ class ManimConfig(MutableMapping):
if attr is not None:
self[key] = attr
+ # dry_run is special because it can only be set to True
+ if hasattr(args, 'dry_run'):
+ if getattr(args, 'dry_run'):
+ self['dry_run'] = True
+
for key in [
"media_dir", # always set this one first
- "dry_run",
"video_dir",
"images_dir",
"tex_dir",
@@ -672,21 +676,17 @@ class ManimConfig(MutableMapping):
@dry_run.setter
def dry_run(self, val):
- if val in [True, False]:
- if val: # dry run
- self.write_to_movie = False
- self.write_all = False
- self.save_last_frame = False
- self.save_pngs = False
- self.save_as_gif = False
- else: # set to default
- self.write_to_movie = True
- self.write_all = False
- self.save_last_frame = False
- self.save_pngs = False
- self.save_as_gif = False
+ if val:
+ self.write_to_movie = False
+ self.write_all = False
+ self.save_last_frame = False
+ self.save_pngs = False
+ self.save_as_gif = False
else:
- raise ValueError(f'dry_run must be boolean')
+ raise ValueError('It is unclear what it means to set dry_run to '
+ 'False. Instead, try setting each option '
+ 'individually. (write_to_movie, write_alll, '
+ 'save_last_frame, save_pngs, or save_as_gif)')
@property
def use_js_renderer(self):
diff --git a/tests/test_scene_rendering/test_caching_relalted.py b/tests/test_scene_rendering/test_caching_relalted.py
deleted file mode 100644
index 7827248e0..000000000
--- a/tests/test_scene_rendering/test_caching_relalted.py
+++ /dev/null
@@ -1,52 +0,0 @@
-import os
-import pytest
-import subprocess
-
-from ..utils.commands import capture
-from ..utils.video_tester import video_comparison
-
-
-@video_comparison(
- "SceneWithMultipleWaitCallsWithNFlag.json",
- "videos/simple_scenes/480p15/SceneWithMultipleWaitCalls.mp4",
-)
-def test_wait_skip(tmp_path, manim_cfg_file, simple_scenes_path):
- # Test for PR #468. Intended to test if wait calls are correctly skipped.
- scene_name = "SceneWithMultipleWaitCalls"
- command = [
- "python",
- "-m",
- "manim",
- simple_scenes_path,
- scene_name,
- "-ql",
- "--media_dir",
- str(tmp_path),
- "-n",
- "3",
- ]
- out, err, exit_code = capture(command)
- assert exit_code == 0, err
-
-
-@video_comparison(
- "SceneWithMultiplePlayCallsWithNFlag.json",
- "videos/simple_scenes/480p15/SceneWithMultipleCalls.mp4",
-)
-def test_play_skip(tmp_path, manim_cfg_file, simple_scenes_path):
- # Intended to test if play calls are correctly skipped.
- scene_name = "SceneWithMultipleCalls"
- command = [
- "python",
- "-m",
- "manim",
- simple_scenes_path,
- scene_name,
- "-ql",
- "--media_dir",
- str(tmp_path),
- "-n",
- "3",
- ]
- out, err, exit_code = capture(command)
- assert exit_code == 0, err