Skip to content

Commit

Permalink
pop taskName for older version of python-json-logger (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau authored Jan 6, 2025
1 parent 21d4694 commit 6704ea6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def test_timestamp_override():
)
handler.flush()
event_capsule = json.loads(output.getvalue())
event_capsule.pop("taskName", None)
assert event_capsule["__timestamp__"] == timestamp_override.isoformat() + "Z"


Expand Down Expand Up @@ -155,6 +156,7 @@ def test_emit():
handler.flush()

event_capsule = json.loads(output.getvalue())
event_capsule.pop("taskName", None)

assert "__timestamp__" in event_capsule
# Remove timestamp from capsule when checking equality, since it is gonna vary
Expand Down Expand Up @@ -200,6 +202,7 @@ def test_message_field():
handler.flush()

event_capsule = json.loads(output.getvalue())
event_capsule.pop("taskName", None)

assert "__timestamp__" in event_capsule
# Remove timestamp from capsule when checking equality, since it is gonna vary
Expand Down Expand Up @@ -248,6 +251,7 @@ def test_nested_message_field():
handler.flush()

event_capsule = json.loads(output.getvalue())
event_capsule.pop("taskName", None)

assert "__timestamp__" in event_capsule
# Remove timestamp from capsule when checking equality, since it is gonna vary
Expand Down Expand Up @@ -411,6 +415,7 @@ def test_unique_logger_instances():
handler1.flush()

event_capsule0 = json.loads(output0.getvalue())
event_capsule0.pop("taskName", None)

assert "__timestamp__" in event_capsule0
# Remove timestamp from capsule when checking equality, since it is gonna vary
Expand All @@ -424,6 +429,7 @@ def test_unique_logger_instances():
assert event_capsule0 == expected

event_capsule1 = json.loads(output1.getvalue())
event_capsule1.pop("taskName", None)

assert "__timestamp__" in event_capsule1
# Remove timestamp from capsule when checking equality, since it is gonna vary
Expand Down

0 comments on commit 6704ea6

Please sign in to comment.