Skip to content

Commit

Permalink
Merge pull request #69 from rolandmas/master
Browse files Browse the repository at this point in the history
Fix compatibility of testsuite with Python 3.12's logging
  • Loading branch information
Zsailer committed May 10, 2024
2 parents 4c7bd06 + 81b1a60 commit 2975fca
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions jupyter_telemetry/tests/test_register_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ def test_timestamp_override():

event_capsule = json.loads(output.getvalue())

# Cope with python3.12
if "taskName" in event_capsule:
del event_capsule["taskName"]

assert event_capsule['__timestamp__'] == timestamp_override.isoformat() + 'Z'


Expand Down Expand Up @@ -125,6 +129,11 @@ def test_record_event():
assert '__timestamp__' in event_capsule
# Remove timestamp from capsule when checking equality, since it is gonna vary
del event_capsule['__timestamp__']

# Cope with python3.12
if "taskName" in event_capsule:
del event_capsule["taskName"]

assert event_capsule == {
'__schema__': 'test/test',
'__schema_version__': 1,
Expand Down Expand Up @@ -295,6 +304,9 @@ def test_unique_logger_instances():
assert '__timestamp__' in event_capsule0
# Remove timestamp from capsule when checking equality, since it is gonna vary
del event_capsule0['__timestamp__']
# Cope with python3.12
if "taskName" in event_capsule0:
del event_capsule0["taskName"]
assert event_capsule0 == {
'__schema__': 'test/test0',
'__schema_version__': 1,
Expand All @@ -307,6 +319,9 @@ def test_unique_logger_instances():
assert '__timestamp__' in event_capsule1
# Remove timestamp from capsule when checking equality, since it is gonna vary
del event_capsule1['__timestamp__']
# Cope with python3.12
if "taskName" in event_capsule1:
del event_capsule1["taskName"]
assert event_capsule1 == {
'__schema__': 'test/test1',
'__schema_version__': 1,
Expand Down

0 comments on commit 2975fca

Please sign in to comment.