Example #1
0
def test_logger_adapter_status():
    log_buffer = io.StringIO()
    log_stream = logging.StreamHandler(stream=log_buffer)
    log_stream.setFormatter(log.LogFormatter())

    log.logger.addHandler(log_stream)

    status = Status()
    status.log.info("here is some info")
    assert log_buffer.getvalue().endswith(
        f"[{str(status)}] here is some info\n")

    status._finished(success=True)
    status.log.info("here is more info")
    assert log_buffer.getvalue().endswith(
        f"[{str(status)}] here is more info\n")
    def kickoff(self):
        print('kickoff', self.name)
        if self._twin_adc is None:
            raise ValueError("ADC must have a twin")

        if self._twin_adc._kickoff_adc is False:
            self._ready_to_collect = True
            "Start writing data into the file."

            # set_and_wait(self.enable_sel, 0)
            st = self.enable_sel.set(0)
            self._kickoff_adc = True
            return st
        else:
            print("ADC {} was kicked off by {} already".format(
                self.name, self._twin_adc.name))
            self._ready_to_collect = True
            #reset kickoff
            self._kickoff_adc = False
            #reset twin
            self._twin_adc._kickoff_adc = False
            st = Status()
            st._finished()
            return st