Skip to content

Commit

Permalink
Replace pytest.raises with try-except-else
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Sep 17, 2024
1 parent 7eb4742 commit 5fe25b5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions setuptools/tests/test_distutils_adoption.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,17 @@ def test_log_module_is_not_duplicated_on_import(distutils_version, venv):


ENSURE_CONSISTENT_ERROR_FROM_MODIFIED_PY = r"""
import pytest
from setuptools.modified import newer
from distutils.error import DistutilsError
with pytest.raises(DistutilsError):
# Can't use pytest.raises in this context
try:
newer("", "")
except DistutilsError:
pass
else:
raise AssertionError("Expected to raise")
"""


Expand Down

0 comments on commit 5fe25b5

Please sign in to comment.