Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Improved performance of ``test_threed.py`` (#2893)

Benjamin Hacklce9acddd41f3
diff --git a/pyproject.toml b/pyproject.toml
index 8cf46395f..326a9f5c7 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -112,7 +112,7 @@ markers = "platform_python_implementation == 'CPython'"
[tool.pytest.ini_options]
markers = "slow: Mark the test as slow. Can be skipped with --skip_slow"
-addopts = "--no-cov-on-fail --cov=manim --cov-report xml --cov-report term -n auto --dist=loadfile"
+addopts = "--no-cov-on-fail --cov=manim --cov-report xml --cov-report term -n auto --dist=loadfile --durations=0"
[tool.isort]
# from https://black.readthedocs.io/en/stable/compatible_configs.html
diff --git a/tests/test_graphical_units/control_data/threed/Arrow3D.npz b/tests/test_graphical_units/control_data/threed/Arrow3D.npz
index d066e9322..8de07115c 100644
Binary files a/tests/test_graphical_units/control_data/threed/Arrow3D.npz and b/tests/test_graphical_units/control_data/threed/Arrow3D.npz differ
diff --git a/tests/test_graphical_units/control_data/threed/Cone.npz b/tests/test_graphical_units/control_data/threed/Cone.npz
index 50dc20364..92036acc5 100644
Binary files a/tests/test_graphical_units/control_data/threed/Cone.npz and b/tests/test_graphical_units/control_data/threed/Cone.npz differ
diff --git a/tests/test_graphical_units/control_data/threed/Line3D.npz b/tests/test_graphical_units/control_data/threed/Line3D.npz
index 05d698208..4f84ff8e1 100644
Binary files a/tests/test_graphical_units/control_data/threed/Line3D.npz and b/tests/test_graphical_units/control_data/threed/Line3D.npz differ
diff --git a/tests/test_graphical_units/control_data/threed/SurfaceColorscale.npz b/tests/test_graphical_units/control_data/threed/SurfaceColorscale.npz
index 2a2a6f7f7..a000b8a25 100644
Binary files a/tests/test_graphical_units/control_data/threed/SurfaceColorscale.npz and b/tests/test_graphical_units/control_data/threed/SurfaceColorscale.npz differ
diff --git a/tests/test_graphical_units/control_data/threed/Y_Direction.npz b/tests/test_graphical_units/control_data/threed/Y_Direction.npz
index 540e7062e..5d72dad8d 100644
Binary files a/tests/test_graphical_units/control_data/threed/Y_Direction.npz and b/tests/test_graphical_units/control_data/threed/Y_Direction.npz differ
diff --git a/tests/test_graphical_units/test_threed.py b/tests/test_graphical_units/test_threed.py
index 64778e404..022201f4c 100644
--- a/tests/test_graphical_units/test_threed.py
+++ b/tests/test_graphical_units/test_threed.py
@@ -30,7 +30,7 @@ def test_Dot3D(scene):
@frames_comparison(base_scene=ThreeDScene)
def test_Cone(scene):
- scene.add(Cone())
+ scene.add(Cone(resolution=16))
@frames_comparison(base_scene=ThreeDScene)
@@ -40,15 +40,16 @@ def test_Cylinder(scene):
@frames_comparison(base_scene=ThreeDScene)
def test_Line3D(scene):
- line1, line2 = Line3D().shift(LEFT * 2), Line3D().shift(RIGHT * 2)
- perp_line = Line3D.perpendicular_to(line1, UP + OUT)
- parallel_line = Line3D.parallel_to(line2, DOWN + IN)
+ line1 = Line3D(resolution=16).shift(LEFT * 2)
+ line2 = Line3D(resolution=16).shift(RIGHT * 2)
+ perp_line = Line3D.perpendicular_to(line1, UP + OUT, resolution=16)
+ parallel_line = Line3D.parallel_to(line2, DOWN + IN, resolution=16)
scene.add(line1, line2, perp_line, parallel_line)
@frames_comparison(base_scene=ThreeDScene)
def test_Arrow3D(scene):
- scene.add(Arrow3D())
+ scene.add(Arrow3D(resolution=16))
@frames_comparison(base_scene=ThreeDScene)
@@ -103,7 +104,7 @@ def test_MovingVertices(scene):
@frames_comparison(base_scene=ThreeDScene)
def test_SurfaceColorscale(scene):
- resolution_fa = 50
+ resolution_fa = 16
scene.set_camera_orientation(phi=75 * DEGREES, theta=-30 * DEGREES)
axes = ThreeDAxes(x_range=(-3, 3, 1), y_range=(-3, 3, 1), z_range=(-4, 4, 1))
@@ -127,7 +128,7 @@ def test_SurfaceColorscale(scene):
@frames_comparison(base_scene=ThreeDScene)
def test_Y_Direction(scene):
- resolution_fa = 42
+ resolution_fa = 16
scene.set_camera_orientation(phi=75 * DEGREES, theta=-120 * DEGREES)
axes = ThreeDAxes(x_range=(0, 5, 1), y_range=(0, 5, 1), z_range=(-1, 1, 0.5))