Use % formatting in logging instead of braces (#5439)

This commit is contained in:
Ben Wu 2024-04-25 13:10:56 -04:00 коммит произвёл GitHub
Родитель f026fc541d
Коммит 7f99fc5160
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -935,7 +935,7 @@ def _run_query(
logging.error(e)
sys.exit(1)
except FileNotFoundError:
logging.warning("No metadata.yaml found for {}", query_file)
logging.warning("No metadata.yaml found for %s", query_file)
if not use_public_table and destination_table is not None:
# destination table was parsed by argparse, however if it wasn't modified to

Просмотреть файл

@ -79,7 +79,7 @@ class JsonPublisher:
self.table = query_file_re.group(2)
self.version = query_file_re.group(3)
else:
logging.error("Invalid file naming format: {}", self.query_file)
logging.error("Invalid file naming format: %s", self.query_file)
sys.exit(1)
def _clear_stage_directory(self):

Просмотреть файл

@ -31,12 +31,12 @@ class TestEntrypoint:
b"+---+-----+\n| a | b |\n+---+-----+\n| 1 | abc |\n+---+-----+\n"
in result
)
assert b"No metadata.yaml found for {}" in result
assert b"No metadata.yaml found for " in result
except subprocess.CalledProcessError as e:
# running bq in CircleCI will fail since it's not installed
# but the error output can be checked for whether bq was called
assert b"No such file or directory: 'bq'" in e.output
assert b"No metadata.yaml found for {}" in e.output
assert b"No metadata.yaml found for " in e.output
assert (
b'subprocess.check_call(["bq"] + query_arguments, stdin=query_stream)'
in e.output
@ -72,12 +72,12 @@ class TestEntrypoint:
b"+---+---+---+\n| a | b | c |\n+---+---+---+\n| a | b | c |\n+---+---+---+"
in result
)
assert b"No metadata.yaml found for {}" in result
assert b"No metadata.yaml found for " in result
except subprocess.CalledProcessError as e:
# running bq in CircleCI will fail since it's not installed
# but the error output can be checked for whether bq was called
assert b"No such file or directory: 'bq'" in e.output
assert b"No metadata.yaml found for {}" in e.output
assert b"No metadata.yaml found for " in e.output
assert (
b'subprocess.check_call(["bq"] + query_arguments, stdin=query_stream)'
in e.output
@ -113,7 +113,7 @@ class TestEntrypoint:
stderr=subprocess.STDOUT,
)
assert b"Current status: DONE" in result
assert b"No metadata.yaml found for {}" in result
assert b"No metadata.yaml found for " in result
result = bigquery_client.query(
f"SELECT a FROM {project_id}.{temporary_dataset}.query_v1"
@ -123,7 +123,7 @@ class TestEntrypoint:
assert row.a == "foo"
except subprocess.CalledProcessError as e:
assert b"No such file or directory: 'bq'" in e.output
assert b"No metadata.yaml found for {}" in e.output
assert b"No metadata.yaml found for " in e.output
assert (
b'subprocess.check_call(["bq"] + query_arguments, stdin=query_stream)'
in e.output