diff --git a/nox/_cli.py b/nox/_cli.py index f1807c59..4fc0091b 100644 --- a/nox/_cli.py +++ b/nox/_cli.py @@ -106,6 +106,8 @@ def check_dependencies(dependencies: list[str]) -> bool: version = importlib.metadata.version(dep.name) if not dep.specifier.contains(version): return False + if dep.url: + return False return True diff --git a/tests/resources/noxfile_script_mode_url_req.py b/tests/resources/noxfile_script_mode_url_req.py new file mode 100644 index 00000000..3a3bb3f9 --- /dev/null +++ b/tests/resources/noxfile_script_mode_url_req.py @@ -0,0 +1,14 @@ +# /// script +# dependencies = ["nox @ git+https://github.com/wntrblm/nox.git@2024.10.09"] +# /// + +# The Nox version pinned above should be the second-most-recent version or older. + +import importlib.metadata + +import nox + + +@nox.session(python=False) +def example(session: nox.Session) -> None: + print(importlib.metadata.version("nox")) diff --git a/tests/test_main.py b/tests/test_main.py index 16258f44..33498245 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1065,3 +1065,25 @@ def test_noxfile_no_script_mode() -> None: ) assert job.returncode == 1 assert "No module named 'cowsay'" in job.stderr + + +def test_noxfile_script_mode_url_req() -> None: + job = subprocess.run( + [ + sys.executable, + "-m", + "nox", + "-f", + Path(RESOURCES) / "noxfile_script_mode_url_req.py", + "-s", + "example", + ], + check=False, + capture_output=True, + text=True, + encoding="utf-8", + ) + print(job.stdout) + print(job.stderr) + assert job.returncode == 0 + assert job.stdout.rstrip() == "2024.10.9"