Skip to content

Commit b97ec14

Browse files
authored
Merge pull request #185 from huguesdevimeux/fix-tests
Fix failing tests
2 parents c077c5c + 7a088cf commit b97ec14

File tree

4 files changed

+16
-32
lines changed

4 files changed

+16
-32
lines changed

manim/animation/indication.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import numpy as np
22

33
from ..constants import *
4+
from ..config import config
45
from ..animation.animation import Animation
56
from ..animation.movement import Homotopy
67
from ..animation.composition import AnimationGroup
@@ -45,7 +46,7 @@ def create_target(self):
4546

4647
def create_starting_mobject(self):
4748
return Dot(
48-
radius=FRAME_X_RADIUS + FRAME_Y_RADIUS,
49+
radius=config['frame_x_radius'] + config['frame_y_radius'],
4950
stroke_width=0,
5051
fill_color=self.color,
5152
fill_opacity=0,

manim/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def _parse_file_writer_config(config_parser, args):
177177
def _parse_cli(arg_list, input=True):
178178
parser = argparse.ArgumentParser(
179179
description='Animation engine for explanatory math videos',
180-
epilog='Made with by the manim community devs'
180+
epilog='Made with <3 by the manim community devs'
181181
)
182182
if input:
183183
parser.add_argument(

tests/test_cli/test_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ def capture(command):
1616
def test_help(python_version):
1717
command = [python_version, "-m", "manim", "--help"]
1818
out, err, exitcode = capture(command)
19-
assert exitcode == 0, f"Manim has been installed incorrectly. Please refer to the troubleshooting section on the wiki. Error:\n{err}"
19+
assert exitcode == 0, f"Manim has been installed incorrectly. Please refer to the troubleshooting section on the wiki. Error:\n{err.decode()}"
2020

2121

2222
@pytest.mark.skip_end_to_end
2323
def test_basicScene(python_version):
2424
""" Simulate SquareToCircle. The cache will be saved in tests_caches/media_temp (temporary directory). This is mainly intended to test the partial-movies process. """
25-
path_basic_scene = os.path.join("tests_data", "basic_scenes.py")
25+
path_basic_scene = os.path.join("tests", "tests_data", "basic_scenes.py")
2626
path_output = os.path.join("tests_cache", "media_temp")
2727
command = [python_version, "-m", "manim", path_basic_scene,
2828
"SquareToCircle", "-l", "--media_dir", path_output]
@@ -35,7 +35,7 @@ def test_basicScene(python_version):
3535
@pytest.mark.skip_end_to_end
3636
def test_WriteStuff(python_version):
3737
"""This is mainly intended to test the caching process of the tex objects"""
38-
path_basic_scene = os.path.join("tests_data", "basic_scenes.py")
38+
path_basic_scene = os.path.join("tests", "tests_data", "basic_scenes.py")
3939
path_output = os.path.join("tests_cache", "media_temp")
4040
command = [python_version, "-m", "manim", path_basic_scene,
4141
"WriteStuff", "-l", "--media_dir", path_output]

tests/testing_utils.py

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77

88
from manim import logger
9-
from manim import config
9+
from manim import config, file_writer_config
1010

1111

1212
class SceneTester:
@@ -34,15 +34,16 @@ class SceneTester:
3434
def __init__(self, scene_object, module_tested, caching_needed=False):
3535
# Disable the the logs, (--quiet is broken) TODO
3636
logging.disable(logging.CRITICAL)
37-
self.path_tests_medias_cache = os.path.join('tests_cache', module_tested)
38-
self.path_tests_data = os.path.join('tests_data', module_tested)
37+
self.path_tests_medias_cache = os.path.join('tests', 'tests_cache', module_tested)
38+
self.path_tests_data = os.path.join('tests', 'tests_data', module_tested)
3939

4040
if caching_needed:
4141
config['text_dir'] = os.path.join(
4242
self.path_tests_medias_cache, scene_object.__name__, 'Text')
43-
config['tex_dir'] = os.path.join(
43+
file_writer_config['tex_dir'] = os.path.join(
4444
self.path_tests_medias_cache, scene_object.__name__, 'Tex')
4545

46+
file_writer_config['skip_animations'] = True
4647
config['pixel_height'] = 480
4748
config['pixel_width'] = 854
4849
config['frame_rate'] = 15
@@ -124,30 +125,12 @@ def set_test_scene(scene_object, module_name):
124125
Normal usage::
125126
set_test_scene(DotTest, "geometry")
126127
"""
128+
file_writer_config['skip_animations'] = True
129+
config['pixel_height'] = 480
130+
config['pixel_width'] = 854
131+
config['frame_rate'] = 15
127132

128-
CONFIG_TEST = {
129-
'camera_config': {
130-
'frame_rate': 15,
131-
'pixel_height': 480,
132-
'pixel_width': 854
133-
},
134-
'end_at_animation_number': None,
135-
'file_writer_config': {
136-
'file_name': None,
137-
'input_file_path': 'test.py',
138-
'movie_file_extension': '.mp4',
139-
'png_mode': 'RGB',
140-
'save_as_gif': False,
141-
'save_last_frame': False,
142-
'save_pngs': False,
143-
'write_to_movie': False
144-
},
145-
'leave_progress_bars': False,
146-
'skip_animations': True,
147-
'start_at_animation_number': None
148-
}
149-
150-
scene = scene_object(**CONFIG_TEST)
133+
scene = scene_object()
151134
data = scene.get_frame()
152135
path = os.path.join("manim", "tests", "tests_data",
153136
"{}".format(module_name))

0 commit comments

Comments
 (0)