Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Increase compatibility with scene-caching's tests.

Aathish54a3a3e97fe6
diff --git a/tests/conftest.py b/tests/conftest.py
index 95f158842..3236483e5 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -4,6 +4,7 @@ import numpy as np
import os
import sys
import logging
+from shutil import rmtree
def pytest_addoption(parser):
@@ -44,3 +45,10 @@ def reset_cfg_file():
yield
with open(cfgfilepath, "w") as cfgfile:
cfgfile.write(original)
+
+
+def clean_tests_cache():
+ yield
+ path_output = os.path.join("tests", "tests_cache", "media_temp")
+ rmtree(path_output)
diff --git a/tests/test_logging/test_logging.py b/tests/test_logging/test_logging.py
index b169a047e..4fc7ba92f 100644
--- a/tests/test_logging/test_logging.py
+++ b/tests/test_logging/test_logging.py
@@ -1,7 +1,6 @@
import subprocess
import os
import sys
-from shutil import rmtree
import pytest
import re
@@ -14,6 +13,7 @@ def capture(command, instream=None):
return out, err, proc.returncode
[email protected]("clean_tests_cache")
def test_logging_to_file(python_version):
"""Test logging Terminal output to a log file.
As some data will differ with each log (the timestamps, file paths, line nums etc)
@@ -21,7 +21,7 @@ def test_logging_to_file(python_version):
whitespace.
"""
path_basic_scene = os.path.join("tests", "tests_data", "basic_scenes.py")
- path_output = os.path.join("tests_cache", "media_temp")
+ path_output = os.path.join("tests", "tests_cache", "media_temp")
command = [
python_version,
"-m",
@@ -37,8 +37,8 @@ def test_logging_to_file(python_version):
]
out, err, exitcode = capture(command)
log_file_path = os.path.join(path_output, "logs", "SquareToCircle.log")
- assert exitcode == 0, err
- assert os.path.exists(log_file_path), err
+ assert exitcode == 0, err.decode()
+ assert os.path.exists(log_file_path), err.decode()
if sys.platform.startswith("win32") or sys.platform.startswith("cygwin"):
enc = "Windows-1252"
else: