示例#1
0
 def _run_command(self, command_constructor, args):
     """
     Run command_constructor and call run(args) on the resulting object
     :param command_constructor: class of an object that implements run(args)
     :param args: object arguments for specific command created by CommandParser
     """
     verify_terminal_encoding(sys.stdout.encoding)
     self._check_pypi_version()
     command = command_constructor(self.config)
     command.run(args)
示例#2
0
 def _run_command(self, command_constructor, args):
     """
     Run command_constructor and call run(args) on the resulting object
     :param command_constructor: class of an object that implements run(args)
     :param args: object arguments for specific command created by CommandParser
     """
     verify_terminal_encoding(sys.stdout.encoding)
     self._check_pypi_version()
     config = create_config(allow_insecure_config_file=args.allow_insecure_config_file)
     self.show_error_stack_trace = config.debug_mode
     command = command_constructor(config)
     command.run(args)
示例#3
0
 def _run_command(self, command_constructor, args):
     """
     Run command_constructor and call run(args) on the resulting object
     :param command_constructor: class of an object that implements run(args)
     :param args: object arguments for specific command created by CommandParser
     """
     verify_terminal_encoding(sys.stdout.encoding)
     self._check_pypi_version()
     config = create_config(allow_insecure_config_file=args.allow_insecure_config_file)
     self.show_error_stack_trace = config.debug_mode
     command = command_constructor(config)
     command.run(args)
示例#4
0
 def test_verify_encoding(self):
     bad_values = [
         'ASCII',
         None,
         'US-ASCII',
         '',
     ]
     good_values = [
         'dataUTFdata'
         'UTF-8',
     ]
     for bad_value in bad_values:
         with self.assertRaises(ValueError):
             verify_terminal_encoding(bad_value)
     for good_value in good_values:
         verify_terminal_encoding(good_value)
示例#5
0
 def test_verify_terminal_encoding_lower(self):
     verify_terminal_encoding('utf')
示例#6
0
 def test_verify_terminal_encoding_upper(self):
     verify_terminal_encoding('UTF')
示例#7
0
 def test_verify_terminal_encoding_none_raises(self):
     with self.assertRaises(ValueError):
         verify_terminal_encoding(None)
示例#8
0
 def test_verify_terminal_encoding_empty_raises(self):
     with self.assertRaises(ValueError):
         verify_terminal_encoding('')
示例#9
0
 def test_verify_terminal_encoding_ascii_raises(self):
     with self.assertRaises(ValueError):
         verify_terminal_encoding('ascii')
示例#10
0
 def test_verify_terminal_encoding_none_is_ok(self):
     verify_terminal_encoding(None)
示例#11
0
 def test_verify_terminal_encoding_upper(self):
     verify_terminal_encoding('UTF')
示例#12
0
 def test_verify_terminal_encoding_empty_is_ok(self):
     verify_terminal_encoding('')
示例#13
0
 def test_verify_terminal_encoding_ascii_raises(self):
     with self.assertRaises(ValueError):
         verify_terminal_encoding('ascii')
示例#14
0
 def test_verify_terminal_encoding_lower(self):
     verify_terminal_encoding('utf')
示例#15
0
 def test_verify_terminal_encoding_none_is_ok(self):
     verify_terminal_encoding(None)
示例#16
0
 def test_verify_terminal_encoding_empty_is_ok(self):
     verify_terminal_encoding('')