Merge pull request #40061 from ClickHouse/vdimir/test-tag-skip-newlines

Skip newlines before Tags in clickhouse-test
This commit is contained in:
Vladimir C 2022-08-10 17:39:42 +02:00 committed by GitHub
commit 08648b7c55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1179,15 +1179,21 @@ class TestSuite:
def is_shebang(line: str) -> bool:
return line.startswith("#!")
def find_tag_line(file):
for line in file:
line = line.strip()
if line and not is_shebang(line):
return line
return ''
def load_tags_from_file(filepath):
comment_sign = get_comment_sign(filepath)
with open(filepath, "r", encoding="utf-8") as file:
try:
line = file.readline()
if is_shebang(line):
line = file.readline()
line = find_tag_line(file)
except UnicodeDecodeError:
return []
return parse_tags_from_line(line, get_comment_sign(filepath))
return parse_tags_from_line(line, comment_sign)
all_tags = {}
start_time = datetime.now()