Beispiel #1
0
    def tearDown(self):
        super(BaseScalyrLogCaptureTestCase, self).tearDown()

        # It's important we close all the open FDs used by loggers otherwise tests will fail on
        # Windows because the file will still be opened
        scalyr_logging.close_handlers()

        if self.__assertion_failed:
            # Print the paths to which we store the output to so they can be introspected by the
            # developer
            test_name = self._testMethodName
            print('Stored agent log file for test "%s" to: %s' %
                  (test_name, self.agent_log_path))
            print('Stored agent debug log file for test "%s" to: %s' %
                  (test_name, self.agent_debug_log_path))

        if not self.__assertion_failed:
            shutil.rmtree(self.logs_directory)
    def tearDown(self):
        # It's important we close all the open FDs used by loggers otherwise tests will fail on
        # Windows because the file will still be opened
        scalyr_logging.close_handlers()

        # close any open sockets
        for s in self.sockets:
            s.close()

        # stop any running monitors - this might be open if an exception was thrown before a test called monitor.stop()
        if self.monitor is not None:
            self.monitor.stop(wait_on_join=False)

        self.logger.removeHandler(self.handler)
        self.handler.close()

        # restore stdout
        sys.stdout = self.old

        # Print any accumulated stdout at the end for ease of debugging
        self.dummy_stream.close()
Beispiel #3
0
    def tearDown(self):
        scalyr_util.SORT_KEYS = False

        # It's important we close all the open FDs used by loggers otherwise tests will fail on
        # Windows because the file will still be opened
        scalyr_logging.close_handlers()
Beispiel #4
0
    def clear(self):
        scalyr_logging.close_handlers()

        if self._root_path.exists():
            shutil.rmtree(six.text_type(self._root_path))