CI: Run upstream unit tests for hatchling

This commit is contained in:
Karolina Surma 2024-07-31 13:18:26 +02:00
parent acb9b09e2f
commit 8bb89c3bf8
4 changed files with 43 additions and 0 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

4
plan.fmf Normal file
View File

@ -0,0 +1,4 @@
discover:
how: fmf
execute:
how: tmt

18
tests/unit/main.fmf Normal file
View File

@ -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

20
tests/unit/runtest.sh Executable file
View File

@ -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