File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,25 @@ def test_package_wrapper_does_not_install_os_packages():
1919 assert "dnf install" not in wrapper
2020
2121
22+ def test_package_wrapper_runs_local_hooks_with_python313 ():
23+ """The hook package must not be imported by the container's CPython 3.9."""
24+ wrapper = Path (PRE_COMMIT_DIR , "package_app_dependencies.sh" ).read_text ()
25+
26+ assert 'PACKAGER_PYTHON="${PY313_BIN}/python"' in wrapper
27+ assert 'SCRIPT=("$PACKAGER_PYTHON" -m local_hooks.package_app_dependencies)' in wrapper
28+ assert "\" $PACKAGER_PYTHON\" -c 'import local_hooks'" in wrapper
29+ assert 'PYTHONPATH="$HOOKS_PYTHONPATH" "$PACKAGER_PYTHON" -c "$check_dependency_key"' in wrapper
30+
31+
32+ def test_package_wrapper_mounts_source_as_importable_local_hooks_package ():
33+ """The source mount must retain the ``/srv/local_hooks`` package layout."""
34+ wrapper = Path (PRE_COMMIT_DIR , "package_app_dependencies.sh" ).read_text ()
35+
36+ assert '-v "$(dirname "$0")":/srv/local_hooks' in wrapper
37+ assert '-e "PYTHONPATH=/srv:/site-packages"' in wrapper
38+ assert '/bin/bash -c "/srv/local_hooks/$script_name"' in wrapper
39+
40+
2241def test_package_wrapper_respects_explicit_python_runtime (tmp_path ):
2342 wrapper = Path (PRE_COMMIT_DIR , "package_app_dependencies.sh" ).read_text ()
2443 legacy_app_dir = os .path .join (PRE_COMMIT_DIR , "tests/data/py3-app" )
Original file line number Diff line number Diff line change 1212mdformat
1313jsonschema
1414lxml
15- django < 5
15+ django >= 5.2.16 , < 5.3
1616jsondiff
Original file line number Diff line number Diff line change @@ -4,14 +4,14 @@ build-backend = "setuptools.build_meta"
44
55[project ]
66name = " local-hooks"
7- requires-python = " >=3.13,<3.15 "
7+ requires-python = " >=3.13,<3.14 "
88version = " 0.1.0"
99dependencies = [
1010 " jinja2" ,
1111 " mdformat" ,
1212 " jsonschema" ,
1313 " lxml" ,
14- " django<5 " ,
14+ " django>=5.2.16,<5.3 " ,
1515 " packaging>=24.2" ,
1616 " requests>=2.33.0" ,
1717 " pip-licenses" ,
You can’t perform that action at this time.
0 commit comments