def test_disabled_capture_fixture_twice(self, pytester: Pytester) -> None:
        """Test that an inner disabled() exit doesn't undo an outer disabled().

        Issue #7148.
        """
        pytester.makepyfile(
            """
            def test_disabled(capfd):
                print('captured before')
                with capfd.disabled():
                    print('while capture is disabled 1')
                    with capfd.disabled():
                        print('while capture is disabled 2')
                    print('while capture is disabled 1 after')
                print('captured after')
                assert capfd.readouterr() == ('captured before\\ncaptured after\\n', '')
        """
        )
        result = pytester.runpytest_subprocess()
        result.stdout.fnmatch_lines(
            [
                "*while capture is disabled 1",
                "*while capture is disabled 2",
                "*while capture is disabled 1 after",
            ],
            consecutive=True,
        )
Test that an inner disabled() exit doesn't undo an outer disabled().

        Issue #7148.
        
testing/test_capture.py