Skip to content

Run the duplicate-action message assertion - #3030

Open
dylanpulver wants to merge 1 commit into
simonw:mainfrom
dylanpulver:run-duplicate-action-assertion
Open

dylanpulver wants to merge 1 commit into
simonw:mainfrom
dylanpulver:run-duplicate-action-assertion

Conversation

@dylanpulver

Copy link
Copy Markdown

test_hook_register_actions_no_duplicates has its assertion inside the with pytest.raises(StartupError) block, below the call that raises:

with pytest.raises(StartupError) as ex:
    await ds.invoke_startup()
    assert f"Duplicate action {duplicate}" in str(ex.value)

invoke_startup() raises, so the assertion is never reached and the error message is unchecked. (ex.value is also only populated after the block exits.)

Verified by replacing the expected string with a deliberately wrong one:

assertion position result
wrong inside the block (as-is) 2 passed
wrong below the block 2 failed
correct below the block 2 passed

So the message does match once the assertion runs. tests/test_plugins.py is 161 passed, 4 skipped before and after, and black --check is clean.

The assertion sat inside the `with pytest.raises(StartupError)` block,
after the call that raises, so it never executed. Moving it below the
block lets it check the message it was written to check.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant