tests.test_config_discovery moduleΒΆ

Test the search for configuration files, in click_extra.config.discovery.

tests.test_config_discovery.test_parent_patterns(tmp_path, search_parents, subdirs, create_file, expected_start)[source]ΒΆ
tests.test_config_discovery.test_parent_patterns_with_magic_pattern(tmp_path, pattern_factory, expected_factory)[source]ΒΆ

Test parent_patterns with glob patterns containing magic characters.

Magic pattern with search_parents=False yields only the original.

tests.test_config_discovery.test_parent_patterns_relative_path(tmp_path)[source]ΒΆ

Test parent_patterns resolves relative paths to absolute.

tests.test_config_discovery.test_parent_patterns_stop_at_path(tmp_path)[source]ΒΆ

stop_at as a path limits the parent directory walk.

tests.test_config_discovery.test_parent_patterns_stop_at_vcs(tmp_path, has_vcs, expected_bounded)[source]ΒΆ

stop_at=VCS stops at VCS root, or walks to filesystem root if none.

tests.test_config_discovery.test_parent_patterns_inaccessible_directory(tmp_path)[source]ΒΆ

Walk stops at an inaccessible directory.

tests.test_config_discovery.test_find_vcs_root(tmp_path, vcs_dir, expected)[source]ΒΆ

Test _find_vcs_root with .git, .hg, and no VCS markers.

tests.test_config_discovery.test_default_magic_characters_match_wcmatch()[source]ΒΆ

The characters _literal_base splits on are the ones wcmatch reads as magic.

Checked under the default search flags, over every printable character.

tests.test_config_discovery.test_literal_base(tmp_path, pattern_factory, expected_factory)[source]ΒΆ

_literal_base stops at the first segment holding glob syntax.

tests.test_config_discovery.test_literal_base_needs_the_default_search_flags()[source]ΒΆ

Custom search flags take wcmatch to read, so no folder is derived.

tests.test_config_discovery.test_search_skips_the_glob_of_a_missing_folder(tmp_path, monkeypatch)[source]ΒΆ

No file can match in a folder that does not exist, so it is never globbed.

tests.test_config_discovery.test_parent_search_goes_on_above_a_missing_folder(tmp_path)[source]ΒΆ

The parent walk still finds a file above a folder that does not exist.

tests.test_config_discovery.test_plain_run_loads_no_search_dependency(tmp_path)[source]ΒΆ

A plain run without a configuration file loads neither extra_platforms nor wcmatch.

Every invocation searches the default configuration folder, which rarely exists: a missing folder is ruled out before wcmatch is imported. The probe runs in a pristine interpreter, since pytest itself has both loaded already. The default folder is pointed at a place that does not exist, on every platform click.get_app_dir() knows, and the working directory holds no pyproject.toml.