Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Add test for current cfg subcommands.

Aathish Sivasubrahmaniancd4252088547
diff --git a/tests/test_cli/manim.cfg b/tests/test_cli/manim.cfg
index b71cfe235..1838b30c2 100644
--- a/tests/test_cli/manim.cfg
+++ b/tests/test_cli/manim.cfg
@@ -1,6 +1,7 @@
[CLI]
movie_file_extension = .mp4
write_to_movie = True
+sound = True
# write_all = False
save_last_frame = True
# save_pngs = False
diff --git a/tests/test_cli/test_cfg_subcmd.py b/tests/test_cli/test_cfg_subcmd.py
new file mode 100644
index 000000000..dfd3b7356
--- /dev/null
+++ b/tests/test_cli/test_cfg_subcmd.py
@@ -0,0 +1,27 @@
+import pytest
+import os
+import shutil
+
+from .test_cli import capture
+
+def test_cfg_help(python_version):
+ command = [python_version, "-m", "manim", "cfg", "--help"]
+ out, err, exitcode = capture(command)
+ assert exitcode == 0, f"The cfg subcommand is not working as intended."
+
+def test_cfg_show(python_version):
+ os.chdir(os.path.dirname(__file__))
+ command = [python_version, "-m", "manim", "cfg", "show"]
+ out, err, exitcode = capture(command)
+ assert exitcode == 0
+ assert f"{os.path.sep}tests{os.path.sep}".encode("utf-8") in out, err
+
+def test_cfg_export(python_version):
+ os.chdir(os.path.dirname(__file__))
+ command = [python_version, "-m", "manim", "cfg", "export", "--dir", "temp"]
+ out, err, exitcode = capture(command)
+ assert exitcode == 0
+ assert os.path.exists(os.path.join("temp","manim.cfg"))
+ with open(os.path.join("temp","manim.cfg"),"r") as writtencfg:
+ assert "sound = True" in writtencfg.read(), err
+ shutil.rmtree("temp")