Skip to content

Commit b8584a8

Browse files
committed
Add more formatting to custom event validatators
1 parent 6d4f67b commit b8584a8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

tests/testing_support/validators/validate_custom_event.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import time
16+
from pprint import pformat
1617

1718
from newrelic.common.object_wrapper import function_wrapper
1819
from testing_support.fixtures import core_application_stats_engine
@@ -61,7 +62,9 @@ def _validate_custom_event_count(wrapped, instance, args, kwargs):
6162
raise
6263
else:
6364
stats = core_application_stats_engine(None)
64-
assert stats.custom_events.num_samples == count
65+
assert stats.custom_events.num_samples == count, (
66+
f"Expected: {count}, Got: {stats.custom_events.num_samples}\nEvents: {pformat(list(stats.custom_events))}"
67+
)
6568

6669
return result
6770

tests/testing_support/validators/validate_custom_events.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import copy
1616
import time
17+
from pprint import pformat
1718

1819
from newrelic.common.object_wrapper import function_wrapper, transient_function_wrapper
1920
from testing_support.fixtures import catch_background_exceptions
@@ -100,8 +101,8 @@ def _check_event_attributes(expected, captured, mismatches):
100101
def _event_details(matching_custom_events, captured, mismatches):
101102
details = [
102103
f"matching_custom_events={matching_custom_events}",
103-
f"mismatches={mismatches}",
104-
f"captured_events={captured}",
104+
f"mismatches={pformat(mismatches)}",
105+
f"captured_events={pformat(captured)}",
105106
]
106107

107108
return "\n".join(details)

0 commit comments

Comments
 (0)