fix(lib): bump Manim and fix OpenGL renderer (#522)

* fix(lib): bump Manim and fix OpenGL renderer

* fix(tests): correctly change cwd
This commit is contained in:
Jérome Eertmans
2025-01-21 13:38:41 +01:00
committed by GitHub
parent 32ab690932
commit adce58e1b7
6 changed files with 416 additions and 167 deletions

View File

@ -4,7 +4,6 @@ import random
import shutil
import sys
import tempfile
import threading
from collections.abc import Iterator
from pathlib import Path
from typing import Any, Union
@ -71,7 +70,9 @@ Slide = Union[CESlide, _GLSlide, CEGLSlide]
reason="See https://github.com/3b1b/manim/issues/2263.",
),
),
"--CE --renderer=opengl",
],
ids=("CE", "GL", "CE(GL)"),
)
def test_render_basic_slide(
renderer: str,
@ -84,7 +85,7 @@ def test_render_basic_slide(
with runner.isolated_filesystem() as tmp_dir:
shutil.copy(manimgl_config, tmp_dir)
results = runner.invoke(
render, [renderer, str(slides_file), "BasicSlide", "-ql"]
render, [*renderer.split(" "), str(slides_file), "BasicSlide", "-ql"]
)
assert results.exit_code == 0, results
@ -235,21 +236,17 @@ def assert_constructs(cls: SlideType) -> None:
init_slide(cls).construct()
_L = (
threading.Lock()
) # We cannot change directory multiple times at once (in the same thread)
@contextlib.contextmanager
def tmp_cwd() -> Iterator[str]:
old_cwd = os.getcwd()
cwd = os.getcwd()
tmp_dir = tempfile.mkdtemp()
with tempfile.TemporaryDirectory() as tmp_dir, _L:
try:
os.chdir(tmp_dir)
yield tmp_dir
finally:
os.chdir(old_cwd)
os.chdir(tmp_dir)
try:
yield tmp_dir
finally:
os.chdir(cwd)
def assert_renders(cls: SlideType) -> None: