summaryrefslogtreecommitdiff
path: root/gerbonara/tests/conftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'gerbonara/tests/conftest.py')
-rw-r--r--gerbonara/tests/conftest.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/gerbonara/tests/conftest.py b/gerbonara/tests/conftest.py
index 7d4e996..242ec04 100644
--- a/gerbonara/tests/conftest.py
+++ b/gerbonara/tests/conftest.py
@@ -18,6 +18,7 @@ def pytest_assertrepr_compare(op, left, right):
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)
def pytest_runtest_makereport(item, call):
@@ -25,6 +26,7 @@ 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 'PYTEST_XDIST_WORKER' in os.environ: # only run this on the controller
@@ -40,6 +42,11 @@ def pytest_sessionstart(session):
def pytest_configure(config):
+ os.nice(20)
+ # Resvg can sometimes consume a lot of memory. Make sure we don't kill the user's session.
+ if (oom_adj := Path('/proc/self/oom_adj')).is_file():
+ oom_adj.write_text('15\n')
+
if 'PYTEST_XDIST_WORKER' in os.environ: # only run this on the controller
return
@@ -48,6 +55,9 @@ def pytest_configure(config):
if not lib_dir.is_dir():
raise ValueError(f'Path "{lib_dir}" given by KICAD_FOOTPRINTS environment variable does not exist or is not a directory.')
+ print('Updating podman image')
+ subprocess.run(['podman', 'pull', 'registry.hub.docker.com/kicad/kicad:nightly'], check=True)
+
print('Checking and bulk re-building KiCad footprint library cache')
with multiprocessing.pool.ThreadPool() as pool: # use thread pool here since we're only monitoring podman processes
lib_dirs = list(lib_dir.glob('*.pretty'))