Пример #1
0
    def __init__(self, mvn_settings: str = None):
        self.log = init_logger(__name__, add_null_handler=False)
        self.log.info("Initializing Maven class.")
        # select maven executable
        self.__mvn_exec = self.get_mvn_executable()
        self.log.info(f"Selected maven executable [{self.__mvn_exec}].")

        # init special maven settings - calculate path
        if not strings.is_str_empty(mvn_settings):
            abs_settings_path = os.path.abspath(mvn_settings)
            if not os.path.exists(
                    abs_settings_path):  # fail-fast for non-existent settings
                raise FileNotFoundError
            self.__mvn_settings = abs_settings_path
        else:
            self.__mvn_settings = None
        self.log.info(
            f"Loaded special maven settings [{self.__mvn_settings}].")
Пример #2
0
 def test_init_logger_doesnt_add_null_handler(self):
     log = init_logger('some_name3', add_null_handler=False)
     self.assertTrue(NullHandler not in log.handlers)
Пример #3
0
 def test_init_logger_add_null_handler(self):
     log = init_logger('some_name2')
     self.assertTrue(NullHandler in log.handlers)
Пример #4
0
 def test_init_logger_return_logger(self):
     log = init_logger('some_name1')
     self.assertTrue(isinstance(log, Logger))
Пример #5
0
 def test_init_logger_empty_name(self):
     with self.assertRaises(PyUtilsException):
         init_logger(None)
Пример #6
0
 def __init__(self, git_url, http=None, https=None):
     self.log = init_logger(__name__, add_null_handler=False)
     self.log.info("Initializing PyGit class.")
     # init internal state
     self.__git_url = git_url