mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-05-21 20:46:01 +08:00
feat(cli): add render command as alias to manim render
(#317)
* feat(cli): add render command as alias to `manim render` * feat(cli): add render command as alias to `manim render` * chore(test): add test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * chore(lib): simplify how ManimGL rendering is called * chore(lib): test * chore(ci): try identify error * wip * chore(test): add result output * try: checkout * Revert "try: checkout" This reverts commit 60985f0b612ca0c6bff9726ebcccf07b1b1c4832. * fix(deps): don't update lock * chore(lib): simplify code and improve usage * chore(cli): better cli * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix: does this fix? --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,10 +1,7 @@
|
||||
import random
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import click
|
||||
import pytest
|
||||
from click.testing import CliRunner
|
||||
from manim import (
|
||||
@ -20,37 +17,23 @@ from manim import (
|
||||
GrowFromCenter,
|
||||
Text,
|
||||
)
|
||||
from manim.__main__ import main as manim_cli
|
||||
from pydantic import ValidationError
|
||||
|
||||
from manim_slides.config import PresentationConfig
|
||||
from manim_slides.defaults import FOLDER_PATH
|
||||
from manim_slides.render import render
|
||||
from manim_slides.slide.manim import Slide
|
||||
|
||||
|
||||
@click.command(
|
||||
context_settings=dict(
|
||||
ignore_unknown_options=True,
|
||||
allow_extra_args=True,
|
||||
)
|
||||
)
|
||||
@click.pass_context
|
||||
def manimgl_cli(ctx: click.Context) -> None:
|
||||
subprocess.run([sys.executable, "-m", "manimlib", *ctx.args])
|
||||
|
||||
|
||||
cli = pytest.mark.parametrize(
|
||||
["cli"],
|
||||
@pytest.mark.parametrize(
|
||||
"renderer",
|
||||
[
|
||||
[manim_cli],
|
||||
[manimgl_cli],
|
||||
"--CE",
|
||||
"--GL",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@cli
|
||||
def test_render_basic_slide(
|
||||
cli: click.Command,
|
||||
renderer: str,
|
||||
slides_file: Path,
|
||||
presentation_config: PresentationConfig,
|
||||
manimgl_config: Path,
|
||||
@ -59,9 +42,11 @@ def test_render_basic_slide(
|
||||
|
||||
with runner.isolated_filesystem() as tmp_dir:
|
||||
shutil.copy(manimgl_config, tmp_dir)
|
||||
results = runner.invoke(cli, [str(slides_file), "BasicSlide", "-ql"])
|
||||
results = runner.invoke(
|
||||
render, [renderer, str(slides_file), "BasicSlide", "-ql"]
|
||||
)
|
||||
|
||||
assert results.exit_code == 0
|
||||
assert results.exit_code == 0, results
|
||||
|
||||
local_slides_folder = (Path(tmp_dir) / "slides").resolve(strict=True)
|
||||
|
||||
|
Reference in New Issue
Block a user