88HERE = os .path .dirname (__file__ )
99PROJECTS_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" ,
2632 ids = ["pyproject.toml" , "setup.cfg" , ".python-version" , "allofthem" ],
2733)
2834def 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)
4148def 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)
5361def 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