# Base class to be used by all test cases defined in the suite # # Copyright (C) 2016 Intel Corporation # # SPDX-License-Identifier: GPL-2.0-only import unittest import logging import json import unidiff from data import PatchTestInput import mailbox import collections import sys import os import re sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'pyparsing')) logger = logging.getLogger('patchtest') debug=logger.debug info=logger.info warn=logger.warn error=logger.error Commit = collections.namedtuple('Commit', ['author', 'subject', 'commit_message', 'shortlog', 'payload']) class PatchtestOEError(Exception): """Exception for handling patchtest-oe errors""" def __init__(self, message, exitcode=1): super().__init__(message) self.exitcode = exitcode class Base(unittest.TestCase): # if unit test fails, fail message will throw at least the following JSON: {"id": } endcommit_messages_regex = re.compile(r'\(From \w+-\w+ rev:|(?