Здраствуйте.У меня возникла проблема в unit Test Python

Launching unittests with arguments python -m unittest test_hw_3_1.TestCase.test_task in /home/sargis/PycharmProjects/python_advanced/module_05_processes_and_threads/homework/Tests

Process finished with exit code 1

import sys
import unittest

from module_05_processes_and_threads.homework.hw_3_1 import Redirect_standard_streams

class TestCase(unittest.TestCase):
    def test_task(self):
        with open('stdout.txt', 'a') as stdout_file:
            with open('stderr.txt', 'a') as stderr_file:
                with Redirect_standard_streams(stdout_file,stderr_file):
                     pass
import sys

class Redirect_standard_streams:
    def __init__(self, stdout, stderr):
        self.stdout = stdout
        self.stderr = stderr

    def __enter__(self):
        sys.stdout = self.stderr
        sys.stderr = self.stdout

    def __exit__(self, exc_type, exc_val, exc_tb):
        self.stdout.close()
        self.stderr.close()

Подскажите пожалуста


Ответы (0 шт):