From d6993270c2a89e3d4b44da712f5f5fec630fb866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 19 Apr 2023 14:34:31 +0200 Subject: [PATCH] CI: Run pytest via script to make it easier to reuse it in python-packaging --- tests/download_data_and_run_pytest.sh | 14 ++++++++++++++ tests/tests.yml | 9 +++------ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100755 tests/download_data_and_run_pytest.sh diff --git a/tests/download_data_and_run_pytest.sh b/tests/download_data_and_run_pytest.sh new file mode 100755 index 0000000..8dca398 --- /dev/null +++ b/tests/download_data_and_run_pytest.sh @@ -0,0 +1,14 @@ +#!/usr/bin/bash -eux +# Use update-test-sources.sh to update the test data + +# When the tests run in python-rpm-generators, +# the structure on disk does not match the dist-git repository. +# We apparently must use the standard-test-source role to grab the sources. +# OTOH in other packages, we must use fedpkg(-minimal). +# The --force flag is required in full-blown fedpkg (the source is unused in spec), +# and it is ignored in fedpkg-minimal (all sources are always downloaded). +test -f test-sources-*.tar.gz || fedpkg sources --force + +tar -xvf test-sources-*.tar.gz -C ./tests/data/scripts_pythondistdeps/ +cd tests/ +python3 -m pytest -vvv diff --git a/tests/tests.yml b/tests/tests.yml index bd27cda..22b2cb7 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -33,16 +33,13 @@ - console_script: dir: . run: ./console_script.sh - - prepare-test-data: - dir: . - run: tar -xvf test-sources-*.tar.gz -C ./tests/data/scripts_pythondistdeps/ - pytest: - dir: ./tests - # Use update-test-sources.sh to update the test data - run: python3 -m pytest -vvv + dir: . + run: ./download_data_and_run_pytest.sh required_packages: - rpm-build - rpmdevtools + - fedpkg-minimal - python3-devel - python3-pip - python3-pytest