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(tmp_path, content, expected)[source]ΒΆ
Only a valid PEP 621
[project]table makes a Python project.
- 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.
- tests.test_pyproject.test_extra_names_reads_the_declared_extras(tmp_path)[source]ΒΆ
Extras come off
[project.optional-dependencies], sorted.
- tests.test_pyproject.test_group_and_extra_names_are_empty_without_a_pyproject(tmp_path)[source]ΒΆ
A directory holding no project declares neither.
- tests.test_pyproject.test_cached_toml_parses_once_per_version_of_the_file(tmp_path)[source]ΒΆ
Reads share one parse until the bytes change.
- tests.test_pyproject.test_cached_toml_raises_on_a_missing_or_broken_file(tmp_path)[source]ΒΆ
The cache holds parses only: each caller decides what a failure means.
pyproject.tomlanduv.lockread through the same parser.
- tests.test_pyproject.test_load_pyproject_doc_is_private_and_editable(tmp_path)[source]ΒΆ
An edit to the editable parse never reaches the shared cached one.
- tests.test_pyproject.test_uv_table(tmp_path, content, expected)[source]ΒΆ
The
[tool.uv]table reads empty when the project declares none.
- tests.test_pyproject.PYPROJECT_BUMPVERSION = '[tool.bumpversion]\ncurrent_version = "4.5.6"\n'ΒΆ
A
pyproject.tomldeclaring its version in the bump-my-version table.