-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Deprecate raises(..., 'code(as_a_string)')
/ warns(..., 'code(as_a_string)')
.
#4443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Deprecate ``raises(..., 'code(as_a_string)')`` and ``warns(..., 'code(as_a_string)')``. See https://docs.pytest.org/en/latest/deprecations.html#raises-warns-exec |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -325,7 +325,7 @@ def test_gen(): | |
assert len(colitems) == 1 | ||
gencol = colitems[0] | ||
assert isinstance(gencol, pytest.Generator) | ||
pytest.raises(ValueError, "gencol.collect()") | ||
pytest.raises(ValueError, gencol.collect) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to highlight the importance of the call visually i'd propose a with statement in that case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if it's ok, I'm going to leave these as is so it's a less noisy diff -- we can clean these up in a followup |
||
|
||
def test_generative_methods_with_explicit_names(self, testdir): | ||
modcol = testdir.getmodulecol( | ||
|
@@ -1103,7 +1103,8 @@ def test_modulecol_roundtrip(testdir): | |
|
||
class TestTracebackCutting(object): | ||
def test_skip_simple(self): | ||
excinfo = pytest.raises(pytest.skip.Exception, 'pytest.skip("xxx")') | ||
with pytest.raises(pytest.skip.Exception) as excinfo: | ||
pytest.skip("xxx") | ||
assert excinfo.traceback[-1].frame.code.name == "skip" | ||
assert excinfo.traceback[-1].ishidden() | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.