Exemplo n.º 1
0
 def test_config_with_test(self):
     """
     Run test mode and pass a config file
     """
     args = self.parser.parse_args([
         '--conf',
         os.path.join(self.fixtures_path, 'cmd-001.conf'), 'test',
         os.path.join(self.fixtures_path, 'cmd-001.yaml'), 'foo-job'
     ])
     config = cmd.setup_config_settings(args)
     self.assertEqual(config.get('jenkins', 'url'),
                      "http://test-jenkins.with.non.default.url:8080/")
Exemplo n.º 2
0
 def test_config_with_test(self):
     """
     Run test mode and pass a config file
     """
     args = self.parser.parse_args(['--conf',
                                    os.path.join(self.fixtures_path,
                                                 'cmd-001.conf'),
                                    'test',
                                    os.path.join(self.fixtures_path,
                                                 'cmd-001.yaml'),
                                    'foo-job'])
     config = cmd.setup_config_settings(args)
     self.assertEqual(config.get('jenkins', 'url'),
                      "http://test-jenkins.with.non.default.url:8080/")
Exemplo n.º 3
0
 def test_config_with_test(self):
     """
     Run test mode and pass a config file
     """
     args = self.parser.parse_args(
         [
             "--conf",
             os.path.join(self.fixtures_path, "cmd-001.conf"),
             "test",
             os.path.join(self.fixtures_path, "cmd-001.yaml"),
             "foo-job",
         ]
     )
     config = cmd.setup_config_settings(args)
     self.assertEqual(config.get("jenkins", "url"), "http://test-jenkins.with.non.default.url:8080/")
Exemplo n.º 4
0
    def __init__(self, args=None):
        if args is None:
            args = []
        parser = self._create_parser()
        self._options = parser.parse_args(args)

        if not self._options.command:
            parser.error("Must specify a 'command' to be performed")

        logger = logging.getLogger()
        if (self._options.log_level is not None):
            self._options.log_level = getattr(logging,
                                              self._options.log_level.upper(),
                                              logger.getEffectiveLevel())
            logger.setLevel(self._options.log_level)

        self._config_file_values = cmd.setup_config_settings(self._options)