tests.test_pyproject moduleΒΆ
Tests for pyproject.toml utilities.
- tests.test_pyproject.test_get_project_name_from_cwd(tmp_path, monkeypatch)[source]ΒΆ
Test that get_project_name reads from pyproject.toml in CWD.
- tests.test_pyproject.test_get_project_name_missing_pyproject(tmp_path, monkeypatch)[source]ΒΆ
Test that get_project_name returns None when no pyproject.toml.
- tests.test_pyproject.test_get_project_name_no_project_section(tmp_path, monkeypatch)[source]ΒΆ
Test that get_project_name returns None when no [project] section.
- tests.test_pyproject.test_get_project_name_with_preloaded_data()[source]ΒΆ
Test that get_project_name accepts pre-parsed pyproject data.
- tests.test_pyproject.test_is_python_project_true_for_pep621(tmp_path)[source]ΒΆ
A PEP 621-compliant
[project]table qualifies as a Python project.
- tests.test_pyproject.test_is_python_project_false_for_tool_only_pyproject(tmp_path)[source]ΒΆ
pyproject.tomlwith only[tool.*]tables is not a Python project.
- tests.test_pyproject.test_is_python_project_false_for_missing_pyproject(tmp_path)[source]ΒΆ
A directory with no
pyproject.tomlis not a Python project.
- tests.test_pyproject.test_is_python_project_false_for_malformed_toml(tmp_path)[source]ΒΆ
A
pyproject.tomlthat fails to parse is not a Python project.
- tests.test_pyproject.test_is_python_project_false_for_invalid_pep621(tmp_path)[source]ΒΆ
A
[project]table missing required PEP 621 fields is not Python.[project]with onlyname(noversion, nodynamic) fails theStandardMetadata.from_pyprojectvalidation, so the repo is not considered Python. Locks in the stricter PEP 621 semantics.
- tests.test_pyproject.test_is_python_project_accepts_preloaded_data()[source]ΒΆ
is_python_projectaccepts a pre-parsedpyproject.tomldict.
- tests.test_pyproject.PEP621_TABLE = '[project]\nname = "melon-stand"\nversion = "0.1.0"\n'ΒΆ
Minimal valid PEP 621 header the
is_python_packagecases build on.
- tests.test_pyproject.test_is_python_package_reads_uv_opt_out(tmp_path, tool_table, expected)[source]ΒΆ
Only
[tool.uv] package = falsedemotes a PEP 621 project.
- tests.test_pyproject.test_is_python_package_implies_is_python_project(tmp_path, content)[source]ΒΆ
A non-Python repo is never a package, whatever
[tool.uv]claims.Locks in the narrowing relation the
PACKAGE_ONLYscope depends on:is_python_packagecan never beTruewhereis_python_projectisFalse, so aPACKAGE_ONLYentry can never outlive aPYTHON_ONLYone.
- tests.test_pyproject.test_is_python_package_false_for_missing_pyproject(tmp_path)[source]ΒΆ
A directory with no
pyproject.tomlbuilds no package.
- tests.test_pyproject.test_is_python_package_accepts_preloaded_data()[source]ΒΆ
is_python_packageaccepts a pre-parsedpyproject.tomldict.
- tests.test_pyproject.test_read_pyproject_toml_survives_file_vanishing_after_check(tmp_path, monkeypatch)[source]ΒΆ
A file disappearing between the existence check and the read yields
{}.The default
project_rootis relative, so the file can be deleted, or the working directory itself removed, in the window between the two. Both land on the missing-file outcome the docstring already promises, rather than escaping asOSError.
- tests.test_pyproject.test_dependency_group_names_reads_the_declared_groups(tmp_path)[source]ΒΆ
Groups come off
[dependency-groups], sorted.