示例#1
0
    def test_get_defaults(self):
        valid_values = {
            'http-timeout': '10.2',
            'http-cache-dir': '/home/foo/.mozregression',
            'bits': '64'
        }

        handle, filepath = tempfile.mkstemp()
        conf_default = main.DEFAULT_CONF_FNAME

        self.addCleanup(os.unlink, filepath)
        self.addCleanup(setattr, main, "DEFAULT_CONF_FNAME", conf_default)

        main.DEFAULT_CONF_FNAME = filepath

        with os.fdopen(handle, 'w') as conf_file:
            conf_file.write('[Defaults]\n')
            for key, value in valid_values.iteritems():
                conf_file.write("%s=%s\n" % (key, value))

        options = main.parse_args(['--bits=32'])

        self.assertEqual(options.http_timeout, 10.2)
        self.assertEqual(options.http_cache_dir, '/home/foo/.mozregression')
        self.assertEqual(options.bits, 32)
示例#2
0
 def setUp(self, get_default_logger):
     self.fetch_config = Mock()
     self.test_runner = Mock()
     self.logger = Mock()
     self.logs = []
     get_default_logger.return_value = Mock(info=self.logs.append)
     self.brunner = BisectRunner(self.fetch_config,
                                 self.test_runner,
                                 parse_args([]))
示例#3
0
 def setUp(self, get_default_logger, get_defaults):
     self.fetch_config = Mock()
     self.test_runner = Mock()
     self.logger = Mock()
     self.logs = []
     get_defaults.return_value = dict()
     get_default_logger.return_value = Mock(info=self.logs.append)
     self.brunner = BisectRunner(self.fetch_config,
                                 self.test_runner,
                                 parse_args([]))
示例#4
0
    def test_get_defaults(self):
        valid_values = {'http-timeout': '10.2',
                        'http-cache-dir': '/home/foo/.mozregression',
                        'bits': '64'}

        handle, filepath = tempfile.mkstemp()
        conf_default = main.DEFAULT_CONF_FNAME

        self.addCleanup(os.unlink, filepath)
        self.addCleanup(setattr, main, "DEFAULT_CONF_FNAME", conf_default)

        main.DEFAULT_CONF_FNAME = filepath

        with os.fdopen(handle, 'w') as conf_file:
            conf_file.write('[Defaults]\n')
            for key, value in valid_values.iteritems():
                conf_file.write("%s=%s\n" % (key, value))

        options = main.parse_args(['--bits=32'])

        self.assertEqual(options.http_timeout, 10.2)
        self.assertEqual(options.http_cache_dir, '/home/foo/.mozregression')
        self.assertEqual(options.bits, 32)