Skip to content

Commit

Permalink
style: avoid changing import
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Oct 29, 2024
1 parent 8129254 commit 20a73b7
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions tests/test_project.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

import nox.project
from nox.project import dependency_groups, python_versions


def test_classifiers():
Expand All @@ -18,19 +18,19 @@ def test_classifiers():
}
}

assert nox.project.python_versions(pyproject) == ["3.7", "3.9", "3.12"]
assert python_versions(pyproject) == ["3.7", "3.9", "3.12"]


def test_no_classifiers():
pyproject = {"project": {"requires-python": ">=3.9"}}
with pytest.raises(ValueError, match="No Python version classifiers"):
nox.project.python_versions(pyproject)
python_versions(pyproject)


def test_no_requires_python():
pyproject = {"project": {"classifiers": ["Programming Language :: Python :: 3.12"]}}
with pytest.raises(ValueError, match='No "project.requires-python" value set'):
nox.project.python_versions(pyproject, max_version="3.13")
python_versions(pyproject, max_version="3.13")


def test_python_range():
Expand All @@ -48,32 +48,21 @@ def test_python_range():
}
}

assert nox.project.python_versions(pyproject, max_version="3.12") == [
"3.10",
"3.11",
"3.12",
]
assert nox.project.python_versions(pyproject, max_version="3.11") == [
"3.10",
"3.11",
]
assert python_versions(pyproject, max_version="3.12") == ["3.10", "3.11", "3.12"]
assert python_versions(pyproject, max_version="3.11") == ["3.10", "3.11"]


def test_python_range_gt():
pyproject = {"project": {"requires-python": ">3.2.1,<3.3"}}

assert nox.project.python_versions(pyproject, max_version="3.4") == [
"3.2",
"3.3",
"3.4",
]
assert python_versions(pyproject, max_version="3.4") == ["3.2", "3.3", "3.4"]


def test_python_range_no_min():
pyproject = {"project": {"requires-python": "==3.3.1"}}

with pytest.raises(ValueError, match="No minimum version found"):
nox.project.python_versions(pyproject, max_version="3.5")
python_versions(pyproject, max_version="3.5")


def test_dependency_groups():
Expand All @@ -90,15 +79,15 @@ def test_dependency_groups():
}
}

assert nox.project.dependency_groups(example, "test") == ["pytest", "coverage"]
assert nox.project.dependency_groups(example, "typing-test") == [
assert dependency_groups(example, "test") == ["pytest", "coverage"]
assert dependency_groups(example, "typing-test") == [
"mypy",
"types-requests",
"pytest",
"coverage",
"useful-types",
]
assert nox.project.dependency_groups(example, "typing_test") == [
assert dependency_groups(example, "typing_test") == [
"mypy",
"types-requests",
"pytest",
Expand Down

0 comments on commit 20a73b7

Please sign in to comment.