Skip to content

Fix failing tests #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion manim/animation/indication.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np

from ..constants import *
from ..config import config
from ..animation.animation import Animation
from ..animation.movement import Homotopy
from ..animation.composition import AnimationGroup
Expand Down Expand Up @@ -45,7 +46,7 @@ def create_target(self):

def create_starting_mobject(self):
return Dot(
radius=FRAME_X_RADIUS + FRAME_Y_RADIUS,
radius=config['frame_x_radius'] + config['frame_y_radius'],
stroke_width=0,
fill_color=self.color,
fill_opacity=0,
Expand Down
2 changes: 1 addition & 1 deletion manim/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _parse_file_writer_config(config_parser, args):
def _parse_cli(arg_list, input=True):
parser = argparse.ArgumentParser(
description='Animation engine for explanatory math videos',
epilog='Made with by the manim community devs'
epilog='Made with <3 by the manim community devs'
)
if input:
parser.add_argument(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ def capture(command):
def test_help(python_version):
command = [python_version, "-m", "manim", "--help"]
out, err, exitcode = capture(command)
assert exitcode == 0, f"Manim has been installed incorrectly. Please refer to the troubleshooting section on the wiki. Error:\n{err}"
assert exitcode == 0, f"Manim has been installed incorrectly. Please refer to the troubleshooting section on the wiki. Error:\n{err.decode()}"


@pytest.mark.skip_end_to_end
def test_basicScene(python_version):
""" Simulate SquareToCircle. The cache will be saved in tests_caches/media_temp (temporary directory). This is mainly intended to test the partial-movies process. """
path_basic_scene = os.path.join("tests_data", "basic_scenes.py")
path_basic_scene = os.path.join("tests", "tests_data", "basic_scenes.py")
path_output = os.path.join("tests_cache", "media_temp")
command = [python_version, "-m", "manim", path_basic_scene,
"SquareToCircle", "-l", "--media_dir", path_output]
Expand All @@ -35,7 +35,7 @@ def test_basicScene(python_version):
@pytest.mark.skip_end_to_end
def test_WriteStuff(python_version):
"""This is mainly intended to test the caching process of the tex objects"""
path_basic_scene = os.path.join("tests_data", "basic_scenes.py")
path_basic_scene = os.path.join("tests", "tests_data", "basic_scenes.py")
path_output = os.path.join("tests_cache", "media_temp")
command = [python_version, "-m", "manim", path_basic_scene,
"WriteStuff", "-l", "--media_dir", path_output]
Expand Down
37 changes: 10 additions & 27 deletions tests/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest

from manim import logger
from manim import config
from manim import config, file_writer_config


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

if caching_needed:
config['text_dir'] = os.path.join(
self.path_tests_medias_cache, scene_object.__name__, 'Text')
config['tex_dir'] = os.path.join(
file_writer_config['tex_dir'] = os.path.join(
self.path_tests_medias_cache, scene_object.__name__, 'Tex')

file_writer_config['skip_animations'] = True
config['pixel_height'] = 480
config['pixel_width'] = 854
config['frame_rate'] = 15
Expand Down Expand Up @@ -124,30 +125,12 @@ def set_test_scene(scene_object, module_name):
Normal usage::
set_test_scene(DotTest, "geometry")
"""
file_writer_config['skip_animations'] = True
config['pixel_height'] = 480
config['pixel_width'] = 854
config['frame_rate'] = 15

CONFIG_TEST = {
'camera_config': {
'frame_rate': 15,
'pixel_height': 480,
'pixel_width': 854
},
'end_at_animation_number': None,
'file_writer_config': {
'file_name': None,
'input_file_path': 'test.py',
'movie_file_extension': '.mp4',
'png_mode': 'RGB',
'save_as_gif': False,
'save_last_frame': False,
'save_pngs': False,
'write_to_movie': False
},
'leave_progress_bars': False,
'skip_animations': True,
'start_at_animation_number': None
}

scene = scene_object(**CONFIG_TEST)
scene = scene_object()
data = scene.get_frame()
path = os.path.join("manim", "tests", "tests_data",
"{}".format(module_name))
Expand Down