👌 Address code review
Edited the changelog for extra clarity, and to fire off auto-formatting Oddly enough, keeping `filename='{filename!r}'` caused an error while collecting tests, but getting rid of the single ticks fixed it Hopefully closes #3191
This commit is contained in:
parent
26d27df6fc
commit
e1e4b226c6
|
@ -9,3 +9,8 @@ When they should write::
|
|||
mocked_object.assert_called_with(3, 4, 5, key='value')
|
||||
|
||||
Because the ``assert_called_with`` method of mock objects already executes an assertion.
|
||||
|
||||
This warning will not be issued when ``None`` is explicitly checked
|
||||
assert none_returning_fun() is None
|
||||
|
||||
will not issue the warning
|
||||
|
|
|
@ -901,7 +901,7 @@ from warnings import warn_explicit
|
|||
warn_explicit(
|
||||
PytestWarning('assertion the value None, Please use "assert is None"'),
|
||||
category=None,
|
||||
filename='{filename}',
|
||||
filename={filename!r},
|
||||
lineno={lineno},
|
||||
)
|
||||
""".format(
|
||||
|
|
|
@ -623,6 +623,8 @@ def test_removed_in_pytest4_warning_as_error(testdir, change_default):
|
|||
else:
|
||||
assert change_default in ("ini", "cmdline")
|
||||
result.stdout.fnmatch_lines(["* 1 passed in *"])
|
||||
|
||||
|
||||
class TestAssertionWarnings:
|
||||
@staticmethod
|
||||
def assert_result_warns(result):
|
||||
|
@ -660,7 +662,6 @@ class TestAssertionWarnings:
|
|||
result = testdir.runpytest()
|
||||
self.assert_result_warns(result)
|
||||
|
||||
@pytest.mark.xfail(strict=True)
|
||||
def test_assert_is_none_no_warn(self, testdir):
|
||||
"""Tests a more simple case of `test_none_function_warns` where `assert None` is explicitly called"""
|
||||
testdir.makepyfile(
|
||||
|
@ -673,10 +674,9 @@ class TestAssertionWarnings:
|
|||
"""
|
||||
)
|
||||
result = testdir.runpytest()
|
||||
self.assert_result_warns(result)
|
||||
result.stdout.fnmatch_lines(["*1 passed in*"])
|
||||
|
||||
@pytest.mark.xfail(strict=True)
|
||||
def test_false_function_no_warn(self, testdir):
|
||||
self.create_file(testdir, False)
|
||||
result = testdir.runpytest()
|
||||
self.assert_result_warns(result)
|
||||
result.stdout.fnmatch_lines(["*1 failed in*"])
|
||||
|
|
Loading…
Reference in New Issue