Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #5
0
 def test_verify_terminal_encoding_lower(self):
     verify_terminal_encoding('utf')
Beispiel #6
0
 def test_verify_terminal_encoding_upper(self):
     verify_terminal_encoding('UTF')
Beispiel #7
0
 def test_verify_terminal_encoding_none_raises(self):
     with self.assertRaises(ValueError):
         verify_terminal_encoding(None)
Beispiel #8
0
 def test_verify_terminal_encoding_empty_raises(self):
     with self.assertRaises(ValueError):
         verify_terminal_encoding('')
Beispiel #9
0
 def test_verify_terminal_encoding_ascii_raises(self):
     with self.assertRaises(ValueError):
         verify_terminal_encoding('ascii')
Beispiel #10
0
 def test_verify_terminal_encoding_none_is_ok(self):
     verify_terminal_encoding(None)
Beispiel #11
0
 def test_verify_terminal_encoding_upper(self):
     verify_terminal_encoding('UTF')
Beispiel #12
0
 def test_verify_terminal_encoding_empty_is_ok(self):
     verify_terminal_encoding('')
Beispiel #13
0
 def test_verify_terminal_encoding_ascii_raises(self):
     with self.assertRaises(ValueError):
         verify_terminal_encoding('ascii')
Beispiel #14
0
 def test_verify_terminal_encoding_lower(self):
     verify_terminal_encoding('utf')
Beispiel #15
0
 def test_verify_terminal_encoding_none_is_ok(self):
     verify_terminal_encoding(None)
Beispiel #16
0
 def test_verify_terminal_encoding_empty_is_ok(self):
     verify_terminal_encoding('')