MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_fixture_excinfo_leak

Method test_fixture_excinfo_leak

testing/python/fixtures.py:623–645  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

621 result.stdout.no_fnmatch_line("*INTERNAL*")
622
623 def test_fixture_excinfo_leak(self, pytester: Pytester) -> None:
624 # on python2 sys.excinfo would leak into fixture executions
625 pytester.makepyfile(
626 """
627 import sys
628 import traceback
629 import pytest
630
631 @pytest.fixture
632 def leak():
633 if sys.exc_info()[0]: # python3 bug :)
634 traceback.print_exc()
635 #fails
636 assert sys.exc_info() == (None, None, None)
637
638 def test_leak(leak):
639 if sys.exc_info()[0]: # python3 bug :)
640 traceback.print_exc()
641 assert sys.exc_info() == (None, None, None)
642 """
643 )
644 result = pytester.runpytest()
645 assert result.ret == 0
646
647
648class TestRequestBasic:

Callers

nothing calls this directly

Calls 2

makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected