def bbpgsql_main(argv): cmd_name = basename(argv[0]) dispatch_map = get_dispatch_map() if cmd_name in dispatch_map: options, args = non_destructive_minimal_parse_and_validate_args(argv) get_config_from_filename_and_set_up_logging(options.config_file) try: dispatch_map[cmd_name]() except Exception, e: get_logger().exception(str(e)) logging.shutdown() stdout.write('\nERROR: %s' % str(e)) exit(1)
def test_non_destructive_with_sys_argv(self): expected_sys_argv = ['', '-c', self.config_path] sys.argv = expected_sys_argv[:] non_destructive_minimal_parse_and_validate_args() self.assertEqual(expected_sys_argv, sys.argv)