diff options
author | jaseg <git@jaseg.de> | 2021-12-29 19:58:20 +0100 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2021-12-29 19:58:20 +0100 |
commit | 3fb26e6940b5ae752308d8a33f2608d266795153 (patch) | |
tree | a563b0cf512e5661b2a450ebf73eafe655ac18b2 /gerbonara/gerber/tests/conftest.py | |
parent | 30dabef9ee83021067957854187b9bbf245c14cf (diff) | |
download | gerbonara-3fb26e6940b5ae752308d8a33f2608d266795153.tar.gz gerbonara-3fb26e6940b5ae752308d8a33f2608d266795153.tar.bz2 gerbonara-3fb26e6940b5ae752308d8a33f2608d266795153.zip |
Basic round-trip works
Diffstat (limited to 'gerbonara/gerber/tests/conftest.py')
-rw-r--r-- | gerbonara/gerber/tests/conftest.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gerbonara/gerber/tests/conftest.py b/gerbonara/gerber/tests/conftest.py new file mode 100644 index 0000000..0ad2555 --- /dev/null +++ b/gerbonara/gerber/tests/conftest.py @@ -0,0 +1,22 @@ + +import pytest + +from .image_support import ImageDifference + +@pytest.hookimpl(tryfirst=True, hookwrapper=True) +def pytest_assertrepr_compare(op, left, right): + if isinstance(left, ImageDifference) or isinstance(right, ImageDifference): + diff = left if isinstance(left, ImageDifference) else right + return [ + f'Image difference assertion failed.', + f' Reference: {diff.ref_path}', + f' Actual: {diff.out_path}', + f' Calculated difference: {diff}', ] + +# store report in node object so tmp_gbr can determine if the test failed. +@pytest.hookimpl(tryfirst=True, hookwrapper=True) +def pytest_runtest_makereport(item, call): + outcome = yield + rep = outcome.get_result() + setattr(item, f'rep_{rep.when}', rep) + |