Skip to content

Commit 5ed8e3c

Browse files
committed
Add more explicit comments to pyptoject tests
1 parent 887fbad commit 5ed8e3c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_pyproject.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
HERE = os.path.dirname(__file__)
99
PROJECTS_DIRECTORY = os.path.abspath(os.path.join(HERE, "testdata", "python-project"))
1010

11+
# Most of this tests, verify against three fixture projects that are located in PROJECTS_DIRECTORY
12+
# - using_pyproject: contains a pyproject.toml file with a project.requires-python field
13+
# - using_setupcfg: contains a setup.cfg file with a options.python_requires field
14+
# - using_pyversion: contains a .python-version file and a pyproject.toml file without any version constraint.
15+
# - allofthem: contains all metadata files all with different version constraints.
16+
1117

1218
@pytest.mark.parametrize(
1319
"project_dir, expected",
@@ -26,6 +32,7 @@
2632
ids=["pyproject.toml", "setup.cfg", ".python-version", "allofthem"],
2733
)
2834
def test_python_project_metadata_detect(project_dir, expected):
35+
"""Test that the metadata files are detected when they exist."""
2936
expectation = [(f, pathlib.Path(project_dir) / f) for f in expected]
3037
assert lookup_metadata_file(project_dir) == expectation
3138

@@ -39,6 +46,7 @@ def test_python_project_metadata_detect(project_dir, expected):
3946
ids=["empty", "missing"],
4047
)
4148
def test_python_project_metadata_missing(project_dir):
49+
"""Test that lookup_metadata_file is able to deal with missing or empty directories."""
4250
assert lookup_metadata_file(project_dir) == []
4351

4452

@@ -51,5 +59,9 @@ def test_python_project_metadata_missing(project_dir):
5159
ids=["option-exists", "option-missing"],
5260
)
5361
def test_pyprojecttoml_python_requires(project_dir, expected):
62+
"""Test that the python_requires field is correctly parsed from pyproject.toml.
63+
64+
Both when the option exists or when it missing in the pyproject.toml file.
65+
"""
5466
pyproject_file = pathlib.Path(project_dir) / "pyproject.toml"
5567
assert parse_pyproject_python_requires(pyproject_file) == expected

0 commit comments

Comments
 (0)