Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion reframe/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import reframe
import reframe.core.settings as settings
import reframe.utility as util
import reframe.utility.jsonext as jsonext
from reframe.core.environments import normalize_module_list
from reframe.core.exceptions import ConfigError, ReframeFatalError
from reframe.core.logging import getlogger
Expand Down Expand Up @@ -225,7 +226,7 @@ def __repr__(self):
f'sources={self._sources!r})')

def __str__(self):
return json.dumps(self._pick_config(), indent=2)
return jsonext.dumps(self._pick_config(), indent=2)

# Delegate everything to either the original config or to the reduced one
# if a system is selected
Expand Down
2 changes: 1 addition & 1 deletion reframe/frontend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ def restrict_logging():
f'no such configuration parameter found: {config_param}'
)
else:
printer.info(json.dumps(value, indent=2))
printer.info(jsonext.dumps(value, indent=2))

sys.exit(0)

Expand Down
3 changes: 3 additions & 0 deletions reframe/utility/jsonext.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def encode(obj, **kwargs):
if inspect.istraceback(obj):
return traceback.format_tb(obj)

if inspect.isfunction(obj):
return f'py::{obj.__qualname__}'

newobj = encode_dict(obj)
if newobj is not None:
return newobj
Expand Down
6 changes: 6 additions & 0 deletions unittests/test_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,12 @@ def test_jsonext_dumps():
)
assert '{"(1, 2, 3)": 1}' == jsonext.dumps({(1, 2, 3): 1})

def foo():
pass

assert ('{"fn": "py::test_jsonext_dumps.<locals>.foo"}' ==
jsonext.dumps({'fn': foo}))


# Classes to test JSON deserialization

Expand Down