Skip to content

Commit

Permalink
Print JSON data using json instead of pprint
Browse files Browse the repository at this point in the history
  • Loading branch information
s0undt3ch committed Feb 23, 2024
1 parent c4c93e6 commit 6d29126
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/42.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The printed output is now the result of `json.dumps` instead of `pprint.pformat`
5 changes: 4 additions & 1 deletion src/pytestshellutils/utils/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ def __str__(self) -> str:
message += f"\n >>>>> STDERR >>>>>\n{self.stderr}\n <<<<< STDERR <<<<<"
if self.data:
message += "\n Parsed JSON Data:\n"
message += "\n".join(f" {line}" for line in pprint.pformat(self.data).splitlines())
message += "\n".join(
f" {line}"
for line in json.dumps(self.data, indent=2, sort_keys=False).splitlines()
)
return message + "\n"


Expand Down

0 comments on commit 6d29126

Please sign in to comment.