示例#1
0
 def test_conf_relative(self):
     with tempfile.NamedTemporaryFile(dir='.') as cf:
         with self.mock_option('conf',
                               cf.name), self.mock_option('debug', False):
             cf.write('debug=True\n'.encode('utf-8'))
             cf.flush()
             apply_options('flower',
                           argv=['--conf=%s' % os.path.basename(cf.name)])
             self.assertTrue(options.debug)
示例#2
0
 def test_conf_abs(self):
     with tempfile.NamedTemporaryFile() as cf:
         with self.mock_option('conf',
                               cf.name), self.mock_option('debug', False):
             cf.write('debug=True\n'.encode('utf-8'))
             cf.flush()
             apply_options('flower', argv=['--conf=%s' % cf.name])
             self.assertEqual(cf.name, options.conf)
             self.assertTrue(options.debug)
示例#3
0
 def test_empty_conf(self):
     with self.mock_option('conf', None):
         apply_options('flower', argv=['--conf=/dev/null'])
         self.assertEqual('/dev/null', options.conf)
示例#4
0
 def test_default_option(self):
     apply_options('flower', argv=[])
     self.assertEqual('flowerconfig.py', options.conf)
示例#5
0
 def test_address(self):
     with self.mock_option('address', '127.0.0.1'):
         apply_options('flower', argv=['--address=foo'])
         self.assertEqual('foo', options.address)
示例#6
0
 def test_port(self):
     with self.mock_option('port', 5555):
         apply_options('flower', argv=['--port=123'])
         self.assertEqual(123, options.port)
示例#7
0
 def test_task_runtime_metric_buckets_no_cmd_line_arg(self):
     apply_options('flower', argv=[])
     self.assertEqual(Histogram.DEFAULT_BUCKETS,
                      options.task_runtime_metric_buckets)
示例#8
0
 def test_task_runtime_metric_buckets_read_from_cmd_line(self):
     apply_options('flower',
                   argv=['--task_runtime_metric_buckets=1,10,inf'])
     self.assertEqual([1.0, 10.0, float('inf')],
                      options.task_runtime_metric_buckets)