Ejemplo n.º 1
0
    def setUp(self):
        TestCase.setUp(self)

        self.protocol = FakeProtocol()
        self.process = FakeProcess()
        self.process.log_identifier = "%s.csv" % self.process.uuid
        self.process.processes[self.protocol.uuid] = FakeProcessData(
            self.protocol, Deferred(), Deferred(), "logid")

        # Make sure the logfile actually exists on disk, otherwise the
        # _process_stopped tests will fail
        try:
            os.makedirs(config["jobtype_task_logs"])
        except OSError as e:
            if e.errno != EEXIST:
                raise
        with open(join(config["jobtype_task_logs"],
                       self.process.log_identifier), "wb"):
            pass

        # Clear the logger pool each time and make
        # sure it won't flush
        logpool.flush_lines = 1e10
        logpool.logs.clear()
        logpool.stopped = False

        # Create a dummy logfile
        logfile_path = join(config["jobtype_task_logs"], "logid")
        with open(logfile_path, "w+") as fakelog:
            fakelog.write("test")
Ejemplo n.º 2
0
 def setUp(self):
     TestCase.setUp(self)
     ConfigurationWithCallbacks.callbacks.clear()