A community-maintained Python framework for creating mathematical animations.
Change manim.cfg to original using pytest fixtures.
Aathish396f2fa1f3a2
diff --git a/tests/conftest.py b/tests/conftest.pyindex c07ad705c..6d309522b 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -30,3 +30,12 @@ def pytest_collection_modifyitems(config, items):@pytest.fixture(scope="module")def python_version():return "python3" if sys.platform == "darwin" else "python"++def reset_config():+ cfgfilepath = os.path.join(os.path.dirname(__file__),"test_cli", "manim.cfg")+ with open(cfgfilepath) as cfgfile:+ original = cfgfile.read()+ yield+ with open(cfgfilepath,"w") as cfgfile:+ cfgfile.write(original)\ No newline at end of filediff --git a/tests/test_cli/test_cfg_subcmd.py b/tests/test_cli/test_cfg_subcmd.pyindex b276ce5c0..68a523265 100644--- a/tests/test_cli/test_cfg_subcmd.py+++ b/tests/test_cli/test_cfg_subcmd.py@@ -28,6 +28,7 @@ def test_cfg_export(python_version):assert "sound = True" in writtencfg.read(), errshutil.rmtree(os.path.join(this_folder,"temp"))[email protected]("reset_config")def test_cfg_write(python_version):"""Simulate using the command `manim cfg write`"""cfgfilepath = os.path.join(this_folder, "manim.cfg")@@ -35,9 +36,6 @@ def test_cfg_write(python_version):"""As the number of config values that `manim cfg write` can modify increases, somust the number of newlines and/or values written in write_cfg_sbcmd_input increase."""- with open(cfgfilepath) as cfgfile:- original = cfgfile.read()-out, err, exitcode = capture(command,instream=open(os.path.join(this_folder, "write_cfg_sbcmd_input.txt")),@@ -47,6 +45,3 @@ def test_cfg_write(python_version):with open(cfgfilepath,"r") as cfgfile:assert "sound = False" in cfgfile.read()-- with open(cfgfilepath,"w") as cfgfile:- cfgfile.write(original)