summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--osprofiler/cmd/commands.py3
-rw-r--r--osprofiler/tests/cmd/test_shell.py5
2 files changed, 5 insertions, 3 deletions
diff --git a/osprofiler/cmd/commands.py b/osprofiler/cmd/commands.py
index 99be83e..876493b 100644
--- a/osprofiler/cmd/commands.py
+++ b/osprofiler/cmd/commands.py
@@ -76,7 +76,8 @@ class TraceCommands(BaseCommand):
return obj
if args.use_json:
- output = json.dumps(trace, default=datetime_json_serialize)
+ output = json.dumps(trace, default=datetime_json_serialize,
+ indent=2)
elif args.use_html:
with open(os.path.join(os.path.dirname(__file__),
"template.html")) as html_template:
diff --git a/osprofiler/tests/cmd/test_shell.py b/osprofiler/tests/cmd/test_shell.py
index fa79c27..fc573ed 100644
--- a/osprofiler/tests/cmd/test_shell.py
+++ b/osprofiler/tests/cmd/test_shell.py
@@ -174,7 +174,7 @@ class ShellTestCase(test.TestCase):
mock_get.return_value = notifications
self.run_command("trace show fake_id --json")
- self.assertEqual("%s\n" % json.dumps(notifications),
+ self.assertEqual("%s\n" % json.dumps(notifications, indent=2),
sys.stdout.getvalue())
@mock.patch("sys.stdout", six.StringIO())
@@ -222,4 +222,5 @@ class ShellTestCase(test.TestCase):
self.run_command("trace show fake_id --json --out='/file'")
output = mock_open.return_value.__enter__.return_value
- output.write.assert_called_once_with(json.dumps(notifications))
+ output.write.assert_called_once_with(json.dumps(notifications,
+ indent=2))