SILENT KILLERPanel

Current Path: > > opt > cloudlinux > venv > lib64 > python3.11 > site-packages > testfixtures > tests


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/cloudlinux/venv/lib64/python3.11/site-packages/testfixtures/tests

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
test_django Directory - -
__init__.py File 64 bytes April 17 2025 13:10:58.
configparser-read.txt File 832 bytes April 17 2025 13:10:58.
configparser-write.txt File 775 bytes April 17 2025 13:10:58.
directory-contents.txt File 739 bytes April 17 2025 13:10:58.
sample1.py File 1137 bytes April 17 2025 13:10:58.
sample2.py File 412 bytes April 17 2025 13:10:58.
sample3.py File 43 bytes April 17 2025 13:10:58.
test_compare.py File 62813 bytes April 17 2025 13:10:58.
test_comparison.py File 22706 bytes April 17 2025 13:10:58.
test_components.py File 974 bytes April 17 2025 13:10:58.
test_date.py File 10659 bytes April 17 2025 13:10:58.
test_datetime.py File 16979 bytes April 17 2025 13:10:58.
test_diff.py File 892 bytes April 17 2025 13:10:58.
test_generator.py File 467 bytes April 17 2025 13:10:58.
test_log_capture.py File 7379 bytes April 17 2025 13:10:58.
test_logcapture.py File 19667 bytes April 17 2025 13:10:58.
test_mappingcomparison.py File 9651 bytes April 17 2025 13:10:58.
test_mock.py File 2245 bytes April 17 2025 13:10:58.
test_outputcapture.py File 4355 bytes April 17 2025 13:10:58.
test_popen.py File 23314 bytes April 17 2025 13:10:58.
test_popen_docs.py File 7684 bytes April 17 2025 13:10:58.
test_rangecomparison.py File 5330 bytes April 17 2025 13:10:58.
test_replace.py File 29971 bytes April 17 2025 13:10:58.
test_replacer.py File 3906 bytes April 17 2025 13:10:58.
test_roundcomparison.py File 4828 bytes April 17 2025 13:10:58.
test_sequencecomparison.py File 12368 bytes April 17 2025 13:10:58.
test_should_raise.py File 9967 bytes April 17 2025 13:10:58.
test_shouldwarn.py File 4619 bytes April 17 2025 13:10:58.
test_stringcomparison.py File 1354 bytes April 17 2025 13:10:58.
test_sybil.py File 4302 bytes April 17 2025 13:10:58.
test_tempdir.py File 2883 bytes April 17 2025 13:10:58.
test_tempdirectory.py File 11215 bytes April 17 2025 13:10:58.
test_time.py File 7734 bytes April 17 2025 13:10:58.
test_twisted.py File 5672 bytes April 17 2025 13:10:58.
test_wrap.py File 6576 bytes April 17 2025 13:10:58.

Reading File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/testfixtures/tests/test_outputcapture.py

import sys
from subprocess import call
from unittest import TestCase

from testfixtures import OutputCapture, compare
from .test_compare import CompareHelper


class TestOutputCapture(CompareHelper, TestCase):

    def test_compare_strips(self):
        with OutputCapture() as o:
            print(' Bar! ')
        o.compare('Bar!')

    def test_compare_doesnt_strip(self):
        with OutputCapture(strip_whitespace=False) as o:
            print(' Bar! ')
        self.check_raises(
            '\tBar!',
            compare=o.compare,
            message="'\\tBar!' (expected) != ' Bar! \\n' (actual)",
        )

    def test_stdout_and_stderr(self):
        with OutputCapture() as o:
            print('hello', file=sys.stdout)
            print('out', file=sys.stderr)
            print('there', file=sys.stdout)
            print('now', file=sys.stderr)
        o.compare("hello\nout\nthere\nnow\n")

    def test_unicode(self):
        with OutputCapture() as o:
            print(u'\u65e5', file=sys.stdout)
        o.compare(u'\u65e5\n')

    def test_separate_capture(self):
        with OutputCapture(separate=True) as o:
            print('hello', file=sys.stdout)
            print('out', file=sys.stderr)
            print('there', file=sys.stdout)
            print('now', file=sys.stderr)
        o.compare(stdout="hello\nthere\n",
                  stderr="out\nnow\n")

    def test_compare_both_at_once(self):
        with OutputCapture(separate=True) as o:
            print('hello', file=sys.stdout)
            print('out', file=sys.stderr)
        self.check_raises(
            stdout="out\n",
            stderr="hello\n",
            compare=o.compare,
            message=(
                'dict not as expected:\n'
                '\n'
                'values differ:\n'
                "'stderr': 'hello' (expected) != 'out' (actual)\n"
                "'stdout': 'out' (expected) != 'hello' (actual)\n"
                '\n'
                "While comparing ['stderr']: 'hello' (expected) != 'out' (actual)\n"
                '\n'
                "While comparing ['stdout']: 'out' (expected) != 'hello' (actual)"
            ),
        )

    def test_original_restore(self):
        o_out, o_err = sys.stdout, sys.stderr
        with OutputCapture() as o:
            self.assertFalse(sys.stdout is o_out)
            self.assertFalse(sys.stderr is o_err)
        self.assertTrue(sys.stdout is o_out)
        self.assertTrue(sys.stderr is o_err)

    def test_double_disable(self):
        o_out, o_err = sys.stdout, sys.stderr
        with OutputCapture() as o:
            self.assertFalse(sys.stdout is o_out)
            self.assertFalse(sys.stderr is o_err)
            o.disable()
            self.assertTrue(sys.stdout is o_out)
            self.assertTrue(sys.stderr is o_err)
            o.disable()
            self.assertTrue(sys.stdout is o_out)
            self.assertTrue(sys.stderr is o_err)
        self.assertTrue(sys.stdout is o_out)
        self.assertTrue(sys.stderr is o_err)

    def test_double_enable(self):
        o_out, o_err = sys.stdout, sys.stderr
        with OutputCapture() as o:
            o.disable()
            self.assertTrue(sys.stdout is o_out)
            self.assertTrue(sys.stderr is o_err)
            o.enable()
            self.assertFalse(sys.stdout is o_out)
            self.assertFalse(sys.stderr is o_err)
            o.enable()
            self.assertFalse(sys.stdout is o_out)
            self.assertFalse(sys.stderr is o_err)
        self.assertTrue(sys.stdout is o_out)
        self.assertTrue(sys.stderr is o_err)


class TestOutputCaptureWithDescriptors(object):

    def test_fd(self, capfd):
        with capfd.disabled(), OutputCapture(fd=True) as o:
            call([sys.executable, '-c', "import sys; sys.stdout.write('out')"])
            call([sys.executable, '-c', "import sys; sys.stderr.write('err')"])
        compare(o.captured, expected='outerr')
        o.compare(expected='outerr')

    def test_fd_separate(self, capfd):
        with capfd.disabled(), OutputCapture(fd=True, separate=True) as o:
            call([sys.executable, '-c', "import sys; sys.stdout.write('out')"])
            call([sys.executable, '-c', "import sys; sys.stderr.write('err')"])
        compare(o.captured, expected='')
        o.compare(stdout='out', stderr='err')

SILENT KILLER Tool