コード例 #1
0
ファイル: test_logs.py プロジェクト: SBGlab/antismash
 def test_logfile_nested_dirs(self):
     with TemporaryDirectory() as temp_dir:
         child = os.path.join(temp_dir, "child")
         assert not os.path.exists(child)
         logfile = os.path.join(child, "nested", "logfile")
         with changed_logging(logfile=logfile):
             logging.warning("during")
         assert os.path.exists(logfile)
コード例 #2
0
ファイル: test_logs.py プロジェクト: SBGlab/antismash
    def test_debug_file(self):
        with NamedTemporaryFile() as logfile:
            with changed_logging(logfile=logfile.name, debug=True):
                logging.debug("during")
            logging.debug("after")

            with open(logfile.name) as handle:
                content = handle.read()
            assert "during" in content
            assert "after" not in content
コード例 #3
0
 def test_debug(self):
     logging.debug("before")
     with changed_logging(debug=True):
         assert self.logger.getEffectiveLevel() == logging.DEBUG
         logging.debug("during")
     assert self.logger.getEffectiveLevel() == logging.WARNING
     logging.debug("after")
     for _, level, msg in self.caplog.record_tuples:
         assert level == logging.DEBUG
         assert "during" in msg
コード例 #4
0
 def test_verbose(self):
     logging.info("before")
     with changed_logging(verbose=True):
         logging.debug("during")
         logging.info("during")
         assert self.logger.getEffectiveLevel() == logging.INFO
     logging.info("after")
     assert self.logger.getEffectiveLevel() == logging.WARNING
     for _, level, msg in self.caplog.record_tuples:
         assert level == logging.INFO
         assert "during" in msg
コード例 #5
0
ファイル: test_logs.py プロジェクト: SBGlab/antismash
    def test_logfile_always_verbose(self):
        with NamedTemporaryFile() as logfile:
            with changed_logging(logfile=logfile.name):
                logging.info("during")
                logging.debug("debug")
            logging.info("after")

            with open(logfile.name) as handle:
                content = handle.read()
            assert "during" in content
            assert "debug" not in content
            assert "after" not in content
コード例 #6
0
ファイル: test_logs.py プロジェクト: SBGlab/antismash
 def test_default(self):
     logging.warning("before")
     with changed_logging():
         logging.warning("during")
         logging.info("during")
         logging.debug("during")
         assert self.logger.getEffectiveLevel() == logging.WARNING
     logging.warning("after")
     assert self.logger.getEffectiveLevel() == logging.WARNING
     assert len(self.caplog.records) == 3
     for _, level, _ in self.caplog.record_tuples:
         assert level == logging.WARNING
コード例 #7
0
ファイル: main.py プロジェクト: rchurt/antismash
def run_antismash(sequence_file: Optional[str], options: ConfigType) -> int:
    """ The complete antismash pipeline. Reads in data, runs detection and
        analysis modules over any records found, then outputs the results to
        file.

        Arguments:
            sequence_file: the sequence file to read in records from, can be
                            None if reusing results
            options: command line options

        Returns:
            0 if requested operations completed succesfully, otherwise 1
            Exceptions may also be raised
    """

    with logs.changed_logging(logfile=options.logfile, verbose=options.verbose,
                              debug=options.debug):
        result = _run_antismash(sequence_file, options)
    return result