tests.test_dep_policy module¶
Tests for the dependency-declaration policy checks.
- tests.test_dep_policy.write_pyproject(tmp_path, body)[source]¶
Write a
pyproject.tomlholding body and return its path.
- tests.test_dep_policy.remedies(findings)[source]¶
The remedy of each finding, for a terse assertion.
- tests.test_dep_policy.test_clean_declaration_reports_nothing(tmp_path)[source]¶
A list that follows every rule produces no finding.
- tests.test_dep_policy.test_upper_bound_on_a_runtime_dependency(tmp_path)[source]¶
A cap propagates to everyone installing this project.
- tests.test_dep_policy.test_every_capping_operator_is_caught(tmp_path, specifier)[source]¶
~=counts: it implies a ceiling even without a<in it.
- tests.test_dep_policy.test_upper_bound_is_allowed_outside_runtime(tmp_path)[source]¶
A dev group may pin harder: nothing downstream inherits it.
- tests.test_dep_policy.test_bare_dependency_is_flagged(tmp_path)[source]¶
No specifier means the tested version and the installed one can differ.
- tests.test_dep_policy.test_extra_of_an_already_floored_package_is_not_bare(tmp_path)[source]¶
click-extra[sphinx]selects an extra, it does not re-declare a floor.Repeating the floor on the second mention would just be a second number to keep in step with the first.
- tests.test_dep_policy.test_aggregate_extra_selecting_the_project_itself_is_not_bare(tmp_path)[source]¶
An
allextra rolling up the project’s own extras can carry no floor.A project never declares itself with a specifier in its own file, so the “floored somewhere else” gate can never catch it, and the resolver picks the version being installed: there is no other release to exclude.
- tests.test_dep_policy.test_unsorted_list_names_only_the_first_offender(tmp_path)[source]¶
One misplaced entry makes every later one look wrong too.
- tests.test_dep_policy.test_type_stub_outside_the_typing_group(tmp_path)[source]¶
A stub reaching a runtime environment is pure weight.
- tests.test_dep_policy.test_type_stub_inside_the_typing_group_is_fine(tmp_path)[source]¶
Where they belong, stubs draw no finding.
- tests.test_dep_policy.test_uncommented_floor_is_flagged(tmp_path)[source]¶
A floor nobody justified cannot be audited later.
- tests.test_dep_policy.test_a_comment_above_the_array_documents_the_whole_group(tmp_path)[source]¶
A run of related entries is usually justified in one block.
- tests.test_dep_policy.test_inline_array_skips_the_comment_check(tmp_path)[source]¶
An inline list has no per-entry line to hang a comment on.
- tests.test_dep_policy.test_missing_file_reports_nothing(tmp_path)[source]¶
A non-Python repo has nothing to check, and must not raise.
- tests.test_dep_policy.test_malformed_requirement_is_skipped(tmp_path)[source]¶
An unparsable entry is somebody else’s error to report.
- tests.test_dep_policy.test_comment_word_count_ignores_markers(comment, words)[source]¶
The
#is stripped before counting; everything else counts.
- tests.test_dep_policy.test_over_long_floor_comment_is_flagged(tmp_path)[source]¶
A comment that narrates every past floor buries the current one.
- tests.test_dep_policy.test_a_short_floor_comment_passes(tmp_path)[source]¶
The rule caps the narration, not the justification.
- tests.test_dep_policy.test_comment_length_is_unchecked_by_default(tmp_path)[source]¶
A caller with no configuration to read gets the presence check alone.
- tests.test_dep_policy.test_a_blank_line_detaches_the_comment_above(tmp_path)[source]¶
An unattached comment leaves the floor undocumented.
- tests.test_dep_policy.test_a_block_comment_excuses_absence_but_not_length(tmp_path)[source]¶
A preamble above the array would otherwise silence every entry.
The escape hatch exists so a run of related entries can be justified in one block. Reading it as a blanket pass makes any project whose array carries a policy preamble unscannable, which is how
meta-package-manageraccumulated a 676-word floor comment.
- tests.test_dep_policy.test_a_wall_moved_above_the_array_is_still_a_wall(tmp_path)[source]¶
Moving the comment up one line must not buy an exemption.
Reported once, against the first entry leaning on the block, rather than once per entry: it is one comment to rewrite.
- tests.test_dep_policy.test_an_array_preamble_documenting_no_floor_is_not_measured(tmp_path)[source]¶
A version-policy header justifies nothing, so length is not its measure.
Every entry below carries its own comment, so the block is a preamble. Flagging it would report a rule about floor comments against a comment that documents no floor.
- tests.test_dep_policy.test_this_repository_follows_its_own_policy()[source]¶
The canonical reference has to pass the rules it ships.
Downstream repos mirror this file’s conventions, so a finding here is either real drift or a rule too strict to be worth enforcing. Run at the configured default rather than at the disabled-by-default
0, since the threshold is exactly the rule most likely to drift back.