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.tomldeclaring one console script.
- tests.test_project.SETUP_CFG_SCRIPTS = '[options.entry_points]\nconsole_scripts =\n vineyard = vineyard.cli:main\n'ΒΆ
A
setup.cfgdeclaring 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 asetup.cfgsitting beside it.
- tests.test_project.test_read_project_scripts_falls_back_to_setup_cfg(tmp_path)[source]ΒΆ
console_scriptsinsetup.cfgis read whenpyproject.tomlhas none.
- 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_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__.pyfrom[project.scripts].
- tests.test_project.test_discover_no_pyproject(tmp_path, monkeypatch)[source]ΒΆ
Returns empty list when
pyproject.tomlis 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_setup_cfg_only(tmp_path)[source]ΒΆ
A project declaring its scripts in
setup.cfgalone is detected too.
- 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.
wrapandconvert-to-mystrefuse the same project, each its own way.