diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plan.fmf b/plan.fmf new file mode 100644 index 0000000..e6427de --- /dev/null +++ b/plan.fmf @@ -0,0 +1,4 @@ +discover: + how: fmf +execute: + how: tmt diff --git a/tests/unit/main.fmf b/tests/unit/main.fmf new file mode 100644 index 0000000..dcaab7b --- /dev/null +++ b/tests/unit/main.fmf @@ -0,0 +1,18 @@ +summary: run upstream unit tests +test: ./runtest.sh +require: + - cargo + - git-core + - python3-click + - python3-filelock + - python3-hatchling + - python3-httpx + - python3-packaging + - python3-pathspec + - python3-platformdirs + - python3-pytest + - python3-pytest-mock + - python3-rich + - python3-tomli-w + - python3-virtualenv +duration: 10m diff --git a/tests/unit/runtest.sh b/tests/unit/runtest.sh new file mode 100755 index 0000000..4dda9f8 --- /dev/null +++ b/tests/unit/runtest.sh @@ -0,0 +1,20 @@ +#!/bin/bash -eux + +# Get the version of our installed component +VERSION=$(rpm -q --queryformat="%{VERSION}" python3-hatchling) + +# The hatch's source code contains the tests for hatchling in tests/backend +git clone --depth 1 --branch hatchling-v$VERSION https://github.com/pypa/hatch/ +cd hatch + +# Delete the hatchling sources from the repository - we want to test the RPM package +rm -r backend/ + +# Work around tests wanting a proper Hatch installation +echo '__version__ = "(bogus)"' > src/hatch/_version.py + +# test_extra_met and test_unknown_extra try to pip install requests[security]==2.25.1 +# which is too old to be compiled for Python 3.13 - skip them +k="not test_extra_met and not test_unknown_extra" + +PYTHONPATH="$PWD/src" python3 -m pytest tests/backend -k "${k}" -v