Skip to content

test_blocklist.py makes an HTTP request at collection time (before any target is selected) #91

@gaurav

Description

@gaurav

Problem

tests/nameres/test_blocklist.py calls load_blocklist_from_gsheet() at module level:

blocklist_entries = load_blocklist_from_gsheet()

This fires an HTTP request to Google Sheets during pytest collection, before any --target is processed and before the user has a chance to skip the test. It makes pytest --collect-only slow and fails immediately with a network error if the sheet is unavailable.

Suggested Fix

Move the call into a session-scoped fixture so it only runs when the tests are actually about to execute:

@pytest.fixture(scope="session")
def blocklist_entries():
    return load_blocklist_from_gsheet()

And parametrize test_check_blocklist_entry using indirect or pytest_generate_tests.

Why it was deferred

Pre-existing behavior made more visible by the PR #67 library refactor. Deferred to avoid scope creep.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions