Review findings on PR #13: - release-branch-semver gives 0.1.0.devN without tags, so the 0.0 guard never fired; check_version() now requires >= 0.2 (unit-tested) - the APPSKELLINGTON_DEBUG child import could resolve the source tree from the cwd and false-pass; it now reports its location and must match - test_ci_workflow: no continue-on-error, matrix python drives container and UV_PYTHON, WIP gate compared whole (mutation-tested) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Unit tests for scripts/smoke_import.py's version checks."""
|
|
|
|
import importlib.util
|
|
import pathlib
|
|
|
|
import pytest
|
|
|
|
SCRIPT = pathlib.Path(__file__).resolve().parent.parent / "scripts" / "smoke_import.py"
|
|
spec = importlib.util.spec_from_file_location("smoke_import", SCRIPT)
|
|
smoke_import = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(smoke_import)
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"version",
|
|
[
|
|
"0.0.0",
|
|
"0.0.1.dev3+gabc1234",
|
|
# release-branch-semver with no tags reachable (shallow clone):
|
|
"0.1.0.dev1+g6bd717f23",
|
|
],
|
|
)
|
|
def test_tagless_versions_are_rejected(version):
|
|
with pytest.raises(SystemExit, match="no tags"):
|
|
smoke_import.check_version(version, expected=None)
|
|
|
|
|
|
@pytest.mark.parametrize("version", ["0.2.3", "0.3.0.dev23+gc361b286c", "1.0.0"])
|
|
def test_tag_derived_versions_pass(version):
|
|
smoke_import.check_version(version, expected=None)
|
|
|
|
|
|
def test_expected_version_must_match_exactly():
|
|
with pytest.raises(SystemExit, match="expected version 0.2.3"):
|
|
smoke_import.check_version("0.2.3.dev1", expected="0.2.3")
|