Skip to content

Commit

Permalink
Ensure test results are always JSON serializable.
Browse files Browse the repository at this point in the history
  • Loading branch information
ntoll committed Sep 17, 2024
1 parent 8d2020f commit 4a15962
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
test_status
), f"Test {test["test_name"]} does not end with {test_status}"

# Ensure the results are JSON serializable.
import json
check = json.dumps(actual_results)

# Create a div to display the results in the page.
page.append(
div(
Expand Down
2 changes: 1 addition & 1 deletion upytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __init__(self, test_function, module_name, test_name, function_id):
and the unique Python id of the test function.
"""
self.test_function = test_function
self.module_name = module_name
self.module_name = str(module_name)
self.test_name = test_name
self.function_id = function_id
self.status = PENDING # the initial state of the test.
Expand Down

0 comments on commit 4a15962

Please sign in to comment.