python-hatchling/tests/unit/runtest.sh

26 lines
1.0 KiB
Bash
Raw Normal View History

#!/bin/bash -eux
# hatchling 1.24+ requires uv and editables for testing - they're not available
# in our systems, hence PyPI installation
# install the specific version of uv that has been released around the time
# the tested hatchling's version was out
# editables 0.5 has been released in July 2023, pinning it just to be sure it works
# we don't rebase packages often in CentOS Stream, so version constraints
# should be reasonably safe to be hardcoded
pip install uv==0.1.35 editables==0.5
# 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
PYTHONPATH="$PWD/src" python3 -m pytest tests/backend -v