Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 28, 2023
1 parent 3b910bf commit 0226d47
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions projects/vdk-plugins/vdk-structlog/tests/test_structlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,18 @@ def test_custom_format_overrides_default(log_format):

for log in logs:
if "Log statement with no bound context" in log:
assert _matches_custom_format(log), \
f"Log format did not match the custom format. Log: {log}"
assert _matches_custom_format(
log
), f"Log format did not match the custom format. Log: {log}"
break
else:
pytest.fail("Log statement with no bound context not found in logs")


def _matches_custom_format(log):
pattern = re.compile(r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}\s+\S{1,12}\s+\S{1,8}")
pattern = re.compile(
r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}\s+\S{1,12}\s+\S{1,8}"
)
return bool(pattern.search(log))


Expand Down

0 comments on commit 0226d47

Please sign in to comment.