mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
* Migrate more `os.path` to `pathlib` in tests * Convert test fixtures to pathlib * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix mypy errors in tests * migrate another pathlib instance Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
67 lines
1.5 KiB
Python
67 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from manim import config, tempconfig
|
|
|
|
|
|
@pytest.fixture
|
|
def manim_cfg_file():
|
|
return Path(__file__).parent / "manim.cfg"
|
|
|
|
|
|
@pytest.fixture
|
|
def simple_scenes_path():
|
|
return Path(__file__).parent / "simple_scenes.py"
|
|
|
|
|
|
@pytest.fixture
|
|
def using_temp_config(tmpdir):
|
|
"""Standard fixture that makes tests use a standard_config.cfg with a temp dir."""
|
|
with tempconfig(
|
|
config.digest_file(Path(__file__).parent.parent / "standard_config.cfg"),
|
|
):
|
|
config.media_dir = tmpdir
|
|
yield
|
|
|
|
|
|
@pytest.fixture
|
|
def using_temp_opengl_config(tmpdir):
|
|
"""Standard fixture that makes tests use a standard_config.cfg with a temp dir."""
|
|
with tempconfig(
|
|
config.digest_file(Path(__file__).parent.parent / "standard_config.cfg"),
|
|
):
|
|
config.media_dir = tmpdir
|
|
config.renderer = "opengl"
|
|
yield
|
|
|
|
|
|
@pytest.fixture
|
|
def disabling_caching():
|
|
with tempconfig({"disable_caching": True}):
|
|
yield
|
|
|
|
|
|
@pytest.fixture
|
|
def infallible_scenes_path():
|
|
return Path(__file__).parent / "infallible_scenes.py"
|
|
|
|
|
|
@pytest.fixture
|
|
def use_opengl_renderer(enable_preview):
|
|
with tempconfig({"renderer": "opengl", "preview": enable_preview}):
|
|
yield
|
|
|
|
|
|
@pytest.fixture
|
|
def force_window_config_write_to_movie():
|
|
with tempconfig({"force_window": True, "write_to_movie": True}):
|
|
yield
|
|
|
|
|
|
@pytest.fixture
|
|
def force_window_config_pngs():
|
|
with tempconfig({"force_window": True, "format": "png"}):
|
|
yield
|