@@ -625,8 +625,8 @@ def test():
625625 result .stdout .fnmatch_lines (["* 1 passed in *" ])
626626class TestAssertionWarnings :
627627 @staticmethod
628- def result_warns (result ):
629- return result .stdout .fnmatch_lines (["*PytestWarning*" ])
628+ def assert_result_warns (result ):
629+ result .stdout .fnmatch_lines (["*PytestWarning*" ])
630630
631631 def test_tuple_warning (self , testdir ):
632632 testdir .makepyfile (
@@ -636,7 +636,7 @@ def test_foo():
636636 """
637637 )
638638 result = testdir .runpytest ()
639- assert self .result_warns (result )
639+ self .assert_result_warns (result )
640640
641641 @staticmethod
642642 def create_file (testdir , return_none ):
@@ -658,26 +658,25 @@ def test_foo():
658658 def test_none_function_warns (self , testdir ):
659659 self .create_file (testdir , True )
660660 result = testdir .runpytest ()
661- assert self .result_warns (result )
661+ self .assert_result_warns (result )
662662
663+ @pytest .mark .xfail (strict = True )
663664 def test_assert_is_none_no_warn (self , testdir ):
664665 """Tests a more simple case of `test_none_function_warns` where `assert None` is explicitly called"""
665666 testdir .makepyfile (
666667 """
667- def foo(return_none):
668- if return_none:
669- return None
670- else:
671- return False
668+ def foo():
669+ return None
672670
673671 def test_foo():
674- assert foo(True ) is None
672+ assert foo() is None
675673 """
676674 )
677675 result = testdir .runpytest ()
678- assert not self .result_warns (result )
676+ self .assert_result_warns (result )
679677
678+ @pytest .mark .xfail (strict = True )
680679 def test_false_function_no_warn (self , testdir ):
681680 self .create_file (testdir , False )
682681 result = testdir .runpytest ()
683- assert not self .result_warns (result )
682+ self .assert_result_warns (result )
0 commit comments