testing: skip some unreachable code in coverage
This commit is contained in:
		
							parent
							
								
									40301effb8
								
							
						
					
					
						commit
						11efe057ea
					
				| 
						 | 
					@ -131,7 +131,7 @@ class TestTraceback_f_g_h:
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                raise ValueError
 | 
					                raise ValueError
 | 
				
			||||||
            except somenoname:  # type: ignore[name-defined] # noqa: F821
 | 
					            except somenoname:  # type: ignore[name-defined] # noqa: F821
 | 
				
			||||||
                pass
 | 
					                pass  # pragma: no cover
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            xyz()
 | 
					            xyz()
 | 
				
			||||||
| 
						 | 
					@ -475,7 +475,7 @@ class TestFormattedExcinfo:
 | 
				
			||||||
        except BaseException:
 | 
					        except BaseException:
 | 
				
			||||||
            excinfo = _pytest._code.ExceptionInfo.from_current()
 | 
					            excinfo = _pytest._code.ExceptionInfo.from_current()
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            assert 0, "did not raise"
 | 
					            assert False, "did not raise"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pr = FormattedExcinfo()
 | 
					        pr = FormattedExcinfo()
 | 
				
			||||||
        source = pr._getentrysource(excinfo.traceback[-1])
 | 
					        source = pr._getentrysource(excinfo.traceback[-1])
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,7 +56,7 @@ def test_source_from_lines() -> None:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_source_from_inner_function() -> None:
 | 
					def test_source_from_inner_function() -> None:
 | 
				
			||||||
    def f():
 | 
					    def f():
 | 
				
			||||||
        pass
 | 
					        raise NotImplementedError()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    source = _pytest._code.Source(f)
 | 
					    source = _pytest._code.Source(f)
 | 
				
			||||||
    assert str(source).startswith("def f():")
 | 
					    assert str(source).startswith("def f():")
 | 
				
			||||||
| 
						 | 
					@ -245,15 +245,15 @@ def test_getline_finally() -> None:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_getfuncsource_dynamic() -> None:
 | 
					def test_getfuncsource_dynamic() -> None:
 | 
				
			||||||
    def f():
 | 
					    def f():
 | 
				
			||||||
        raise ValueError
 | 
					        raise NotImplementedError()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def g():
 | 
					    def g():
 | 
				
			||||||
        pass
 | 
					        pass  # pragma: no cover
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    f_source = _pytest._code.Source(f)
 | 
					    f_source = _pytest._code.Source(f)
 | 
				
			||||||
    g_source = _pytest._code.Source(g)
 | 
					    g_source = _pytest._code.Source(g)
 | 
				
			||||||
    assert str(f_source).strip() == "def f():\n    raise ValueError"
 | 
					    assert str(f_source).strip() == "def f():\n    raise NotImplementedError()"
 | 
				
			||||||
    assert str(g_source).strip() == "def g():\n    pass"
 | 
					    assert str(g_source).strip() == "def g():\n    pass  # pragma: no cover"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_getfuncsource_with_multine_string() -> None:
 | 
					def test_getfuncsource_with_multine_string() -> None:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue