tests.test_project moduleΒΆ

Tests for the project and entry-point discovery of click_extra.project.

tests.test_project.PYPROJECT_SCRIPTS = '[project]\nname = "orchard"\n\n[project.scripts]\norchard = "orchard.cli:main"\n'ΒΆ

A pyproject.toml declaring one console script.

tests.test_project.SETUP_CFG_SCRIPTS = '[options.entry_points]\nconsole_scripts =\n    vineyard = vineyard.cli:main\n'ΒΆ

A setup.cfg declaring one console script.

tests.test_project.src_project(tmp_path)[source]ΒΆ

A src-layout project declaring one console script.

Its package carries two empty placeholders: a build field, which always resolves, and a git field, which cannot resolve outside a repository.

tests.test_project.test_read_project_scripts_prefers_pyproject(tmp_path)[source]ΒΆ

[project.scripts] wins over a setup.cfg sitting beside it.

tests.test_project.test_read_project_scripts_falls_back_to_setup_cfg(tmp_path)[source]ΒΆ

console_scripts in setup.cfg is read when pyproject.toml has none.

tests.test_project.test_read_project_scripts_without_metadata(tmp_path)[source]ΒΆ
tests.test_project.test_entry_point_package(target, expected)[source]ΒΆ
tests.test_project.test_locate_package_root(tmp_path, layout, expected)[source]ΒΆ

The directory to import from follows the package through both layouts.

tests.test_project.test_locate_package_root_misses_an_absent_package(tmp_path)[source]ΒΆ
tests.test_project.test_discover_package_init_files_finds_a_src_layout(src_project)[source]ΒΆ

A package under src/ is discovered like one at the project root.

tests.test_project.test_discover_package_init_files_defaults_to_the_current_directory(src_project, monkeypatch)[source]ΒΆ

Without a directory, the paths are relative to the current one.

tests.test_project.test_discover_finds_init(tmp_path, monkeypatch)[source]ΒΆ

Discovers __init__.py from [project.scripts].

tests.test_project.test_discover_no_pyproject(tmp_path, monkeypatch)[source]ΒΆ

Returns empty list when pyproject.toml is missing.

tests.test_project.test_discover_no_scripts(tmp_path, monkeypatch)[source]ΒΆ

Returns empty list when [project.scripts] is absent.

tests.test_project.test_discover_deduplicates(tmp_path, monkeypatch)[source]ΒΆ

Multiple scripts from the same package yield one path.

tests.test_project.test_detect_source_package_single(tmp_path)[source]ΒΆ
tests.test_project.test_detect_source_package_src_layout(tmp_path)[source]ΒΆ
tests.test_project.test_detect_source_package_setup_cfg_only(tmp_path)[source]ΒΆ

A project declaring its scripts in setup.cfg alone is detected too.

tests.test_project.test_detect_source_package_no_entry_point(tmp_path)[source]ΒΆ
tests.test_project.test_detect_source_package_multiple(tmp_path)[source]ΒΆ
tests.test_project.test_detect_source_package_no_project(tmp_path)[source]ΒΆ

A directory holding no packaging metadata names the place it read.

tests.test_project.test_resolve_entry_point_ambiguity_rule(tmp_path, scripts, target)[source]ΒΆ

The scripts must name one target, however many names point to it.

Two targets are ambiguous even inside one package: nothing tells which function the project means.

tests.test_project.test_resolve_entry_point_src_layout(src_project)[source]ΒΆ

The entry point knows its module, function, package and import root.

tests.test_project.test_resolve_entry_point_package_not_on_disk(tmp_path)[source]ΒΆ

A package absent from disk leaves the root to each caller to settle.

tests.test_project.test_callers_share_the_ambiguity_rule(tmp_path)[source]ΒΆ

wrap and convert-to-myst refuse the same project, each its own way.