summaryrefslogtreecommitdiff
path: root/gerbonara/gerber/tests/conftest.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2021-12-30 22:20:51 +0100
committerjaseg <git@jaseg.de>2021-12-30 22:20:51 +0100
commit9db91239ea0eac21f38435c1388f86f94f9ce8f3 (patch)
treec888dc9cdfdbde9e1a4f59976424689880400ddf /gerbonara/gerber/tests/conftest.py
parentf4b2e74923cc95c683cd7f5c4732d92e4aafd3ba (diff)
downloadgerbonara-9db91239ea0eac21f38435c1388f86f94f9ce8f3.tar.gz
gerbonara-9db91239ea0eac21f38435c1388f86f94f9ce8f3.tar.bz2
gerbonara-9db91239ea0eac21f38435c1388f86f94f9ce8f3.zip
Fix more tests
Diffstat (limited to 'gerbonara/gerber/tests/conftest.py')
-rw-r--r--gerbonara/gerber/tests/conftest.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/gerbonara/gerber/tests/conftest.py b/gerbonara/gerber/tests/conftest.py
index c6a1221..131ca28 100644
--- a/gerbonara/gerber/tests/conftest.py
+++ b/gerbonara/gerber/tests/conftest.py
@@ -1,4 +1,6 @@
+from pathlib import Path
+
import pytest
from .image_support import ImageDifference
@@ -8,7 +10,8 @@ def pytest_assertrepr_compare(op, left, right):
diff = left if isinstance(left, ImageDifference) else right
return [
f'Image difference assertion failed.',
- f' Calculated difference: {diff}', ]
+ f' Calculated difference: {diff}',
+ f' Histogram: {diff.histogram}', ]
# store report in node object so tmp_gbr can determine if the test failed.
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
@@ -17,3 +20,11 @@ def pytest_runtest_makereport(item, call):
rep = outcome.get_result()
setattr(item, f'rep_{rep.when}', rep)
+fail_dir = Path('gerbonara_test_failures')
+def pytest_sessionstart(session):
+ if not hasattr(session.config, 'workerinput'): # on worker
+ return
+
+ # on coordinator
+ for f in chain(fail_dir.glob('*.gbr'), fail_dir.glob('*.png')):
+ f.unlink()