def test_error(self):
        tool = "foo"
        args = Namespace(subparser_name=tool, log_file=None, verbose=None)
        logger.initialize_logger(args)
        logger.error("bar")

        root_logger = logger.logging.getLogger()

        current_time = datetime.now().strftime("%Y-%m-%d")
        output_lines = self.output.getvalue().rstrip().split("\n")

        ##nosetests overwrites logger.FileHandler
        self.assertEquals(["root: ERROR: bar"], root_logger.handlers[0].buffer)

        self.assertRegexpMatches(output_lines[0], "" + current_time + r".*\|ERROR\|foo\|bar")
Example #2
0
def _check_snp_indel_pairings(altered_file_names, args):
    if not set([len(i) for i in altered_file_names.values()]) == set([1]):
        if not args.allow_inconsistent_sample_sets:
            error = 0
            for file_names in altered_file_names.values():
                if len(file_names) % 2 != 0:
                    message = "File {} was missing a " "corresponding snp/indel file."
                    logger.error(message, file_names)
                    error = 1
            if error:
                message = (
                    "Not all patients were represented by the same set "
                    "of caller-VCFs. Review inputs/command options to "
                    "align file pairings or use the flag "
                    "--allow_inconsistent_sample_sets."
                )
                raise utils.UsageError(message)