Fix local tests

modern_python v0.10.9
jaseg 2022-06-21 12:07:13 +02:00
rodzic 6752dab125
commit ee233317f1
7 zmienionych plików z 38 dodań i 16 usunięć

Wyświetl plik

@ -151,8 +151,12 @@ def svg_soup(filename):
f.write(str(soup))
def cleanup_gerbv_svg(soup):
soup.svg['width'] = f'{float(soup.svg["width"])/72*25.4:.4f}mm'
soup.svg['height'] = f'{float(soup.svg["height"])/72*25.4:.4f}mm'
width = soup.svg["width"]
height = soup.svg["height"]
width = width[:-2] if width.endswith('pt') else width
height = height[:-2] if height.endswith('pt') else height
soup.svg['width'] = f'{float(width)/72*25.4:.4f}mm'
soup.svg['height'] = f'{float(height)/72*25.4:.4f}mm'
for group in soup.find_all('g'):
# gerbv uses Cairo's SVG canvas. Cairo's SVG canvas is kind of broken. It has no support for unit
# handling at all, which means the output files just end up being in pixels at 72 dpi. Further, it

Wyświetl plik

@ -2,7 +2,7 @@
FROM docker.io/archlinux:latest
MAINTAINER gerbolyze@jaseg.de
RUN pacman --noconfirm -Syu
RUN pacman --noconfirm -Sy git python python-pip base-devel python-numpy python-slugify python-lxml python-click python-pillow librsvg python-scipy python-sphinx python-pytest twine python-beautifulsoup4 gerbv rustup cargo
RUN pacman --noconfirm -Sy git python python-pip base-devel python-numpy python-slugify python-lxml python-click python-pillow librsvg python-scipy python-sphinx python-pytest twine python-beautifulsoup4 gerbv rustup cargo rsync
RUN python3 -m pip install pytest-parallel
RUN rustup install stable
RUN rustup default stable

1
podman/testdata/.gitignore vendored 100644
Wyświetl plik

@ -0,0 +1 @@
git

Wyświetl plik

@ -1,12 +1,7 @@
#!/bin/sh
set -e
git clone /data/git git
rsync -av /data/git git
cd git
if [ $# -ge 1 -a "$1" = "--parallel" ]; then
python3 -m pytest --workers auto
else
python3 -m pytest -x
fi
python3 -m pytest $@

Wyświetl plik

@ -2,6 +2,7 @@
FROM docker.io/ubuntu:latest
MAINTAINER gerbolyze@jaseg.de
RUN env DEBIAN_FRONTEND=noninteractive apt update -y
RUN env DEBIAN_FRONTEND=noninteractive apt install -y python3 git python3-wheel curl python3-pip python3-venv cargo
RUN env DEBIAN_FRONTEND=noninteractive apt install -y python3 git python3-wheel curl python3-pip python3-venv cargo gerbv
RUN cargo install usvg resvg
RUN python3 -m pip install numpy slugify lxml click pillow scipy sphinx pytest beautifulsoup4 pytest-parallel
RUN env DEBIAN_FRONTEND=noninteractive apt install -y rsync

3
pytest.ini 100644
Wyświetl plik

@ -0,0 +1,3 @@
[pytest]
testpaths = gerbonara/tests
norecursedirs=*

Wyświetl plik

@ -1,14 +1,32 @@
#!/bin/sh
set -e
CONTAINER_ARGS="$@"
rm -rf podman/testdata/git
git clone --depth 1 . podman/testdata/git
while [ $# -gt 0 ]; do
case $1 in
--parallel)
CONTAINER_ARGS="--workers auto $CONTAINER_ARGS"
shift;;
-x)
CONTAINER_ARGS="-x $CONTAINER_ARGS"
shift;;
--no-cache)
NO_CACHE=--no-cache
shift;;
*)
echo "Unknown argument \"$1\""
exit 1
shift;;
esac
done
for distro in arch ubuntu
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
for distro in ubuntu arch
do
podman build -t gerbonara-$distro-testenv -f podman/$distro-testenv
podman build $NO_CACHE -t gerbonara-$distro-testenv -f podman/$distro-testenv
mkdir -p /tmp/gerbonara-test-out
podman run --mount type=bind,src=podman/testdata,dst=/data,ro --mount type=bind,src=/tmp/gerbonara-test-out,dst=/out gerbonara-$distro-testenv /data/testscript.sh $CONTAINER_ARGS
done