From 74fb384c4c0899f4d6f153da8db748a7a49e78ee Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 9 Nov 2023 19:16:37 +0100 Subject: aperture macros: work around gerbv/jlc wonkiness --- gerbonara/tests/image_support.py | 2 +- gerbonara/tests/test_cli.py | 48 ++++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'gerbonara/tests') diff --git a/gerbonara/tests/image_support.py b/gerbonara/tests/image_support.py index 64f59ea..b1b0f59 100644 --- a/gerbonara/tests/image_support.py +++ b/gerbonara/tests/image_support.py @@ -162,7 +162,7 @@ def kicad_fp_export(mod_file, out_svg): fp_name = mod_file.name[:-len('.kicad_mod')] cmd = ['podman', 'run', '--mount', f'type=bind,src={pretty_dir},dst=/{pretty_dir.name}', '--mount', f'type=bind,src={tmpdir},dst=/out', - 'registry.gitlab.com/kicad/kicad-ci/kicad-cli-docker/kicad:nightly', + 'registry.hub.docker.com/kicad/kicad:nightly', 'kicad-cli', 'fp', 'export', 'svg', '--output', '/out', '--footprint', fp_name, f'/{pretty_dir.name}'] subprocess.run(cmd, check=True) #, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) out_file = Path(tmpdir) / f'{fp_name}.svg' diff --git a/gerbonara/tests/test_cli.py b/gerbonara/tests/test_cli.py index d5a0ad4..22f5a72 100644 --- a/gerbonara/tests/test_cli.py +++ b/gerbonara/tests/test_cli.py @@ -43,28 +43,28 @@ def file_mock(): class TestRender: - def invoke(self, *args): + def invoke(self, outfile, *args): runner = CliRunner() res = runner.invoke(cli.render, list(map(str, args))) - print(res.output) + outfile.write_text(str(res.output)) if res.exception: raise res.exception assert res.exit_code == 0 return res.output - def test_basic(self): - assert self.invoke('--version').startswith('Version ') + def test_basic(self, tmpfile): + assert self.invoke(tmpfile('Standard output', '.svg'), '--version').startswith('Version ') @pytest.mark.parametrize('reference', ['example_flash_obround.gbr'], indirect=True) - def test_warnings(self, reference): + def test_warnings(self, reference, tmpfile): with pytest.warns(UserWarning): - self.invoke(reference, '--warnings=once') + self.invoke(tmpfile('Standard output', '.svg'), reference, '--warnings=once') @pytest.mark.parametrize('reference', ['kicad-older'], indirect=True) - def test_side(self, reference): - without = self.invoke(reference, '--warnings=ignore') - top = self.invoke(reference, '--top', '--warnings=ignore') - bottom = self.invoke(reference, '--bottom', '--warnings=ignore') + def test_side(self, reference, tmpfile): + without = self.invoke(tmpfile('Standard output, without args', '.svg'), reference, '--warnings=ignore') + top = self.invoke(tmpfile('Standard output, --top', '.svg'), reference, '--top', '--warnings=ignore') + bottom = self.invoke(tmpfile('Standard output, --bottom', '.svg'), reference, '--bottom', '--warnings=ignore') assert top.strip().startswith('