mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-09-21 00:54:25 +08:00
feat(lib): propagate manim render
exit code (#545)
* feat: propagate `manim render` exit code * changelog * test * fix typo
This commit is contained in:
@ -10,6 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
(unreleased)=
|
(unreleased)=
|
||||||
## [Unreleased](https://github.com/jeertmans/manim-slides/compare/v5.5.1...HEAD)
|
## [Unreleased](https://github.com/jeertmans/manim-slides/compare/v5.5.1...HEAD)
|
||||||
|
|
||||||
|
(unreleased-added)=
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- `manim-slides render` now exits with the same return code as the one returned by `manim render` or `manimgl`.
|
||||||
|
[@chrjabs](https://github.com/chrjabs) [#545](https://github.com/jeertmans/manim-slides/pull/545)
|
||||||
|
|
||||||
(unreleased-chore)=
|
(unreleased-chore)=
|
||||||
### Chore
|
### Chore
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ def render(ce: bool, gl: bool, args: tuple[str, ...]) -> None:
|
|||||||
if ce and gl:
|
if ce and gl:
|
||||||
raise click.UsageError("You cannot specify both --CE and --GL renderers.")
|
raise click.UsageError("You cannot specify both --CE and --GL renderers.")
|
||||||
if gl:
|
if gl:
|
||||||
subprocess.run([sys.executable, "-m", "manimlib", "-w", *args])
|
completed = subprocess.run([sys.executable, "-m", "manimlib", "-w", *args])
|
||||||
else:
|
else:
|
||||||
subprocess.run([sys.executable, "-m", "manim", "render", *args])
|
completed = subprocess.run([sys.executable, "-m", "manim", "render", *args])
|
||||||
|
sys.exit(completed.returncode)
|
||||||
|
@ -42,3 +42,8 @@ class BasicSlide(Slide):
|
|||||||
|
|
||||||
class BasicSlideSkipReversing(BasicSlide):
|
class BasicSlideSkipReversing(BasicSlide):
|
||||||
skip_reversing = True
|
skip_reversing = True
|
||||||
|
|
||||||
|
|
||||||
|
class FailingSlide(Slide):
|
||||||
|
def construct(self):
|
||||||
|
self.play("this fails to render")
|
||||||
|
@ -113,6 +113,37 @@ def test_render_basic_slide(
|
|||||||
assert local_presentation_config.resolution == presentation_config.resolution
|
assert local_presentation_config.resolution == presentation_config.resolution
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"renderer",
|
||||||
|
[
|
||||||
|
"--CE",
|
||||||
|
pytest.param(
|
||||||
|
"--GL",
|
||||||
|
marks=pytest.mark.skipif(
|
||||||
|
sys.version_info < (3, 10),
|
||||||
|
reason="See https://github.com/3b1b/manim/issues/2263.",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
"--CE --renderer=opengl",
|
||||||
|
],
|
||||||
|
ids=("CE", "GL", "CE(GL)"),
|
||||||
|
)
|
||||||
|
def test_render_failing_slide(
|
||||||
|
renderer: str,
|
||||||
|
slides_file: Path,
|
||||||
|
manimgl_config: Path,
|
||||||
|
) -> None:
|
||||||
|
runner = CliRunner()
|
||||||
|
|
||||||
|
with runner.isolated_filesystem() as tmp_dir:
|
||||||
|
shutil.copy(manimgl_config, tmp_dir)
|
||||||
|
results = runner.invoke(
|
||||||
|
render, [*renderer.split(" "), str(slides_file), "FailingSlide", "-ql"]
|
||||||
|
)
|
||||||
|
|
||||||
|
assert results.exit_code != 0, results
|
||||||
|
|
||||||
|
|
||||||
def test_clear_cache(
|
def test_clear_cache(
|
||||||
slides_file: Path,
|
slides_file: Path,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
Reference in New Issue
Block a user