tests.test_threads module

Tests for repomatic.github.threads.

tests.test_threads.TITLE = 'Papaya harvest report'

Arbitrary thread title the locking tests match against.

tests.test_threads.LOCKED_ERROR_MESSAGE = 'GraphQL: Unable to create comment because issue is locked (addComment)'

Verbatim gh failure when GitHub refuses a comment on a locked conversation.

tests.test_threads.patch_gh(**mock_kwargs)

The conftest patch_gh, bound to this module’s dispatch points.

tests.test_threads.test_thread_kind_reads_the_flag(is_pr, kind, label)[source]

The flag picks the kind, which names its gh command and its label.

tests.test_threads.test_add_labels_targets_the_thread(kind, repository, expected)[source]

The write names the kind’s command, and the repository when given.

tests.test_threads.test_add_labels_without_anything_to_add_makes_no_call()[source]

No label and no assignee is a no-op, not an empty edit.

tests.test_threads.test_add_labels_degrades_a_refusal_to_a_warning()[source]

A refused assignee loses the labels, never the job.

tests.test_threads.test_locked_conversation_is_unlocked_then_retried()[source]

A lock blocking a comment is cleared, then the original write replayed.

tests.test_threads.test_unlocking_targets_the_repository_of_the_write()[source]

The unlock reaches the repository the refused write named.

tests.test_threads.test_unrelated_failure_propagates_without_unlocking()[source]

Only a lock triggers the unlock: every other failure surfaces as-is.

tests.test_threads.test_lock_surviving_the_unlock_still_raises()[source]

The retry is bounded to one: a lock that outlives the unlock is fatal.

tests.test_threads.test_search_window_counts_back_from_today()[source]

The updated:< cutoff is inactive_days before now, not a fixed date.

tests.test_threads.test_each_kind_is_commented_then_locked_with_its_own_wording(is_pr, kind, comment)[source]

Issues and PRs take the gh verb and the comment that match their kind.

tests.test_threads.test_excluded_labels_spare_a_thread(labels, expected)[source]

A thread carrying an excluded label is reported, never written to.

The default exclusion is the bot label, because those issues are designed to reopen when their condition recurs and a lock refuses the reopen comment.

tests.test_threads.test_dry_run_reports_without_writing()[source]

The default mode searches and reports, and never comments or locks.

tests.test_threads.test_empty_comment_skips_the_comment_call()[source]

Locking silently is one call, not a comment with an empty body.

tests.test_threads.test_every_write_names_the_repository()[source]

gh resolves a repo from the checkout: the locker never relies on that.

The autolock job runs on a schedule with no pull request in sight, and a downstream caller may point the command at another repository entirely, so the slug travels on each call rather than through the working directory.