Skip to content

Commit

Permalink
TST Fix test_conversion_missing (#341)
Browse files Browse the repository at this point in the history
This test is failing in CIs in #340.

I think it is because there is no warning raised (not sure why the
`UserWarning` is there). It used to pass because of this bug in pytest
pytest-dev/pytest#9036, but this was fixed in
pytest-dev/pytest#11129 and included in a recent
release, thus our CIs are failing.

Note that I have update the test to be more specific about the exception
raised (`PackageNotFoundError`) but it is not needed, subclass
exceptions are still accepted by pytest. Also added a message to be more
specific.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
lucyleeow and pre-commit-ci[bot] authored Mar 8, 2024
1 parent 595b088 commit 37d4ba4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/test_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,18 @@ def test_conversion_entry_point_string(npe1_repo, mock_npe1_pm_with_plugin):


def test_conversion_missing():
with pytest.raises(ModuleNotFoundError), pytest.warns(UserWarning):
with pytest.raises(
PackageNotFoundError,
match="No package or entry point found with name",
):
manifest_from_npe1("does-not-exist-asdf6as987")


def test_conversion_package_is_not_a_plugin():
with pytest.raises(PackageNotFoundError):
with pytest.raises(
PackageNotFoundError,
match="No package or entry point found with name",
):
manifest_from_npe1("pytest")


Expand Down

0 comments on commit 37d4ba4

Please sign in to comment.