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)
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)
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)
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)
def test_verify_terminal_encoding_lower(self): verify_terminal_encoding('utf')
def test_verify_terminal_encoding_upper(self): verify_terminal_encoding('UTF')
def test_verify_terminal_encoding_none_raises(self): with self.assertRaises(ValueError): verify_terminal_encoding(None)
def test_verify_terminal_encoding_empty_raises(self): with self.assertRaises(ValueError): verify_terminal_encoding('')
def test_verify_terminal_encoding_ascii_raises(self): with self.assertRaises(ValueError): verify_terminal_encoding('ascii')
def test_verify_terminal_encoding_none_is_ok(self): verify_terminal_encoding(None)
def test_verify_terminal_encoding_upper(self): verify_terminal_encoding('UTF')
def test_verify_terminal_encoding_empty_is_ok(self): verify_terminal_encoding('')
def test_verify_terminal_encoding_ascii_raises(self): with self.assertRaises(ValueError): verify_terminal_encoding('ascii')
def test_verify_terminal_encoding_lower(self): verify_terminal_encoding('utf')
def test_verify_terminal_encoding_none_is_ok(self): verify_terminal_encoding(None)
def test_verify_terminal_encoding_empty_is_ok(self): verify_terminal_encoding('')