fix local tests

This commit is contained in:
jaseg 2022-06-21 15:34:14 +02:00
parent e73b577178
commit 0cf02e9c1d
5 changed files with 28 additions and 13 deletions

View file

@ -40,26 +40,26 @@ def run_command(*args):
def test_template_round_trip():
with tempfile.NamedTemporaryFile(suffix='.svg') as out_svg,\
tempfile.TemporaryDirectory() as out_dir:
run_command('python', '-m', 'gerbolyze', 'empty-template', '--force', out_svg.name)
run_command('python', '-m', 'gerbolyze', 'convert', out_svg.name, out_dir)
run_command('python3', '-m', 'gerbolyze', 'empty-template', '--force', out_svg.name)
run_command('python3', '-m', 'gerbolyze', 'convert', out_svg.name, out_dir)
def test_zip_write():
with tempfile.NamedTemporaryFile(suffix='.svg') as out_svg,\
tempfile.NamedTemporaryFile(suffix='.zip') as out_zip:
run_command('python', '-m', 'gerbolyze', 'empty-template', '--force', out_svg.name)
run_command('python', '-m', 'gerbolyze', 'convert', out_svg.name, out_zip.name)
run_command('python3', '-m', 'gerbolyze', 'empty-template', '--force', out_svg.name)
run_command('python3', '-m', 'gerbolyze', 'convert', out_svg.name, out_zip.name)
@pytest.mark.parametrize('reference', REFERENCE_SVGS)
def test_complex_conversion(reference):
infile = reference_path(reference)
with tempfile.NamedTemporaryFile(suffix='.zip') as out_zip:
run_command('python', '-m', 'gerbolyze', 'convert', infile, out_zip.name)
run_command('python', '-m', 'gerbolyze', 'convert', '--pattern-complete-tiles-only', '--use-apertures-for-patterns', infile, out_zip.name)
run_command('python3', '-m', 'gerbolyze', 'convert', infile, out_zip.name)
run_command('python3', '-m', 'gerbolyze', 'convert', '--pattern-complete-tiles-only', '--use-apertures-for-patterns', infile, out_zip.name)
@pytest.mark.parametrize('reference', REFERENCE_GERBERS)
def test_template(reference):
with tempfile.NamedTemporaryFile(suffix='.zip') as out_svg:
infile = reference_path(reference)
run_command('python', '-m', 'gerbolyze', 'template', '--top', '--force', infile, out_svg.name)
run_command('python', '-m', 'gerbolyze', 'template', '--bottom', '--force', '--vector', infile, out_svg.name)
run_command('python3', '-m', 'gerbolyze', 'template', '--top', '--force', infile, out_svg.name)
run_command('python3', '-m', 'gerbolyze', 'template', '--bottom', '--force', '--vector', infile, out_svg.name)

View file

@ -7,4 +7,4 @@ RUN python3 -m pip install pytest-parallel
RUN rustup install stable
RUN rustup default stable
RUN cargo install usvg resvg
RUN python3 -m pip install --upgrade gerbonara

View file

@ -1,7 +1,18 @@
#!/bin/sh
set -e
rsync -av /data/git git
rsync -a /data/git/ git/
cd git
git config --global --add safe.directory $(realpath git)
cp svg-flatten/build/svg-flatten.wasm svg-flatten/svg_flatten_wasi/
cd svg-flatten
python3 setup.py install
cd ..
pip install --upgrade --no-cache-dir 'gerbonara>=0.11.0'
python3 setup.py install
export WASMTIME_BACKTRACE_DETAILS=1
python3 -m pytest $@

View file

@ -5,4 +5,4 @@ RUN env DEBIAN_FRONTEND=noninteractive apt update -y
RUN env DEBIAN_FRONTEND=noninteractive apt install -y libopencv-dev libpugixml-dev libpangocairo-1.0-0 libpango1.0-dev libcairo2-dev clang make python3 git python3-wheel curl python3-pip python3-venv cargo rsync gerbv
RUN cargo install usvg resvg
RUN python3 -m pip install numpy slugify lxml click pillow scipy sphinx pytest beautifulsoup4 pytest-parallel
RUN python3 -m pip install --upgrade gerbonara

View file

@ -20,9 +20,13 @@ while [ $# -gt 0 ]; do
esac
done
make -C svg-flatten -j build/svg-flatten.wasm
rm -rf podman/testdata/git
mkdir -p podman/testdata/git
git ls-tree --full-tree -r HEAD --name-only | rsync -lptgoDv --delete . --files-from - podman/testdata/git/
#git clone --depth 1 . podman/testdata/git
git clone --depth 1 . podman/testdata/git
git ls-tree --full-tree -r HEAD --name-only | rsync -lptgoD --delete . --files-from - podman/testdata/git/
rsync -a --delete svg-flatten/build/svg-flatten.wasm podman/testdata/git/svg-flatten/build/
for distro in ubuntu-old ubuntu arch
do