Skip to content

Commit 7e2ea86

Browse files
authored
Fix some config options specified via --config_file not being respected properly (#4401)
1 parent 6b66878 commit 7e2ea86

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

manim/_config/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ def digest_parser(self, parser: configparser.ConfigParser) -> Self:
595595
"enable_wireframe",
596596
"force_window",
597597
"no_latex_cleanup",
598+
"dry_run",
598599
]:
599600
setattr(self, key, parser["CLI"].getboolean(key, fallback=False))
600601

@@ -629,6 +630,7 @@ def digest_parser(self, parser: configparser.ConfigParser) -> Self:
629630
"background_color",
630631
"renderer",
631632
"window_position",
633+
"preview_command",
632634
]:
633635
setattr(self, key, parser["CLI"].get(key, fallback="", raw=True))
634636

manim/cli/render/global_options.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,23 @@ def validate_gui_location(
125125
"--force_window",
126126
is_flag=True,
127127
help="Force window to open when using the opengl renderer, intended for debugging as it may impact performance",
128-
default=False,
128+
default=None,
129129
),
130130
option(
131131
"--dry_run",
132132
is_flag=True,
133133
help="Renders animations without outputting image or video files and disables the window",
134-
default=False,
134+
default=None,
135135
),
136136
option(
137137
"--no_latex_cleanup",
138138
is_flag=True,
139139
help="Prevents deletion of .aux, .dvi, and .log files produced by Tex and MathTex.",
140-
default=False,
140+
default=None,
141141
),
142142
option(
143143
"--preview_command",
144144
help="The command used to preview the output file (for example vlc for video files)",
145-
default="",
145+
default=None,
146146
),
147147
)

tests/test_scene_rendering/test_cli_flags.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,3 +745,33 @@ def test_input_file_via_cfg(tmp_path, manim_cfg_file, simple_scenes_path):
745745
]
746746
out, err, exit_code = capture(command, cwd=tmp_path)
747747
assert exit_code == 0, err
748+
749+
750+
@pytest.mark.slow
751+
def test_dry_run_via_config_file_no_output(tmp_path, simple_scenes_path):
752+
"""Test that no file is created when dry_run is set to true in a config file."""
753+
scene_name = "SquareToCircle"
754+
config_file = tmp_path / "test_config.cfg"
755+
config_file.write_text(
756+
"""
757+
[CLI]
758+
dry_run = true
759+
"""
760+
)
761+
762+
command = [
763+
sys.executable,
764+
"-m",
765+
"manim",
766+
"--config_file",
767+
str(config_file),
768+
"--media_dir",
769+
str(tmp_path),
770+
str(simple_scenes_path),
771+
scene_name,
772+
]
773+
out, err, exit_code = capture(command)
774+
assert exit_code == 0, err
775+
776+
assert not (tmp_path / "videos").exists(), "videos folder was created in dry_run"
777+
assert not (tmp_path / "images").exists(), "images folder was created in dry_run"

0 commit comments

Comments
 (0)