mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
[Experimental] Added GraphicalDeviationError exception (#4576)
* Added the GraphicalDeviationError exception * Adjusted error message * Add a note about __module__ = "builtins"
This commit is contained in:
parent
2995ad4040
commit
05c8e37ac7
1 changed files with 13 additions and 1 deletions
|
|
@ -20,6 +20,16 @@ FRAME_MISMATCH_RATIO_TOLERANCE = 1e-5
|
|||
logger = logging.getLogger("manim")
|
||||
|
||||
|
||||
class GraphicalDeviationError(Exception):
|
||||
# The __module__ parameter is set to "builtins" to avoid the full
|
||||
# specifier for the exception to be included in the output from pytest.
|
||||
# That is go from
|
||||
# manim.utils.testing._frames_testers.GraphicalDeviationError
|
||||
# to
|
||||
# GraphicalDeviationError
|
||||
__module__ = "builtins"
|
||||
|
||||
|
||||
class _FramesTester:
|
||||
def __init__(self, file_path: Path, show_diff: bool = False) -> None:
|
||||
self._file_path = file_path
|
||||
|
|
@ -81,7 +91,9 @@ class _FramesTester:
|
|||
self._frames[frame_number],
|
||||
self._file_path.name,
|
||||
)
|
||||
raise
|
||||
raise GraphicalDeviationError(
|
||||
f"{number_of_mismatches} pixels differ when comparing with '{self._file_path.name}'"
|
||||
) from None
|
||||
|
||||
|
||||
class _ControlDataWriter(_FramesTester):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue