@@ -74,11 +74,25 @@ def test_dependency_lockfile_and_upper_bounds_parity() -> None:
7474 assert re .search (rf"^{ pkg } ==[\d.]+" , lock_text , re .MULTILINE ), f"{ pkg } must be pinned in requirements-lock.txt"
7575
7676 # Verify requirements.txt defines upper bounds matching pyproject.toml
77+ # (compared structurally so that Dependabot range bumps stay green when both files move together)
7778 req_file = ROOT / "requirements.txt"
7879 req_text = req_file .read_text (encoding = "utf-8" )
79- assert "<7.0.0" in req_text , "requirements.txt must specify PySide6 / pyinstaller upper bounds"
80- assert "<13.0.0" in req_text , "requirements.txt must specify Pillow upper bound"
81- assert "<26.0.0" in req_text , "requirements.txt must specify keyring upper bound"
80+ pyproject_text = (ROOT / "pyproject.toml" ).read_text (encoding = "utf-8" )
81+ spec_re = r"^\s*\"?{pkg}(>=[\d.]+,<[\d.]+)\"?,?\s*$"
82+ for pkg in ("PySide6" , "pyinstaller" , "Pillow" , "keyring" ):
83+ req_match = re .search (spec_re .format (pkg = pkg ), req_text , re .MULTILINE )
84+ pyproject_match = re .search (spec_re .format (pkg = pkg ), pyproject_text , re .MULTILINE )
85+ assert req_match , f"requirements.txt must specify a lower and upper bound for { pkg } "
86+ assert pyproject_match , f"pyproject.toml must specify a lower and upper bound for { pkg } "
87+ assert req_match .group (1 ) == pyproject_match .group (1 ), (
88+ f"{ pkg } range differs: requirements.txt { req_match .group (1 )} vs pyproject.toml { pyproject_match .group (1 )} "
89+ )
90+ lock_match = re .search (rf"^{ pkg } ==([\d.]+)" , lock_text , re .MULTILINE )
91+ upper = req_match .group (1 ).split (",<" )[1 ]
92+ lock_version = tuple (int (p ) for p in lock_match .group (1 ).split ("." ))
93+ assert lock_version < tuple (int (p ) for p in upper .split ("." )), (
94+ f"{ pkg } =={ lock_match .group (1 )} in requirements-lock.txt violates upper bound <{ upper } "
95+ )
8296
8397
8498def test_third_party_licenses_complete_and_accurate () -> None :
0 commit comments