tests/deckard: use deckard submodule for testing

parent 2c935f35
Pipeline #37121 passed with stage
in 1 minute and 24 seconds
......@@ -30,11 +30,6 @@ test:pylint:
test:pytest:
<<: *debian_stable
script:
- git clone --depth=1 https://gitlab.labs.nic.cz/knot/deckard.git /tmp/deckard
- pushd /tmp/deckard
- make depend -C "/tmp/deckard" &>/dev/null
- popd
- export DECKARD_PATH=/tmp/deckard
- python3 -m pytest tests/
test:respdiff:
......
[submodule "ci/deckard"]
path = ci/deckard
url = https://gitlab.labs.nic.cz/knot/deckard.git
Subproject commit 0164c2a37c384fabba57098d4b30e6381c36e581
......@@ -3,6 +3,7 @@ set -e
# Find Python scripts
FILES=$(find . \
-path './ci' -prune -o \
-name '*.py' -print)
python3 -m mypy --ignore-missing-imports ${FILES}
......@@ -4,6 +4,7 @@ set -e
# Find Python modules and standalone Python scripts
FILES=$(find . \
-type d -exec test -e '{}/__init__.py' \; -print -prune -o \
-path './ci' -prune -o \
-name '*.py' -print)
python3 -m pylint -j 2 --rcfile pylintrc ${FILES}
import os
import subprocess
import sys
import pytest
DECKARD_PATH = os.path.normpath(os.path.join(
os.path.dirname(os.path.abspath(__file__)), '..', '..', 'ci', 'deckard'))
try:
DECKARD_PATH = os.environ['DECKARD_PATH']
except KeyError:
pytest.skip("DECKARD_PATH env var not set", allow_module_level=True)
subprocess.run(
'test -f "{path}/env.sh" || make depend -C "{path}"'.format(path=DECKARD_PATH),
cwd=DECKARD_PATH,
shell=True,
check=True)
except subprocess.CalledProcessError as exc:
pytest.skip(
"Failed to compile deckard: {}".format(exc), allow_module_level=True)
else:
sys.path.append(DECKARD_PATH)
pytest.importorskip("pydnstest")
if not os.path.exists(os.path.join(DECKARD_PATH, 'env.sh')):
pytest.skip(
"env.sh script doesn't exist in DECKARD_PATH",
allow_module_level=True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment