sts-sponsors team mailing list archive
-
sts-sponsors team
-
Mailing list archive
-
Message #03584
[Merge] ~ack/maas:perf-results-formatted into maas:master
Alberto Donato has proposed merging ~ack/maas:perf-results-formatted into maas:master.
Commit message:
print out indented perftest output to stdout
Requested reviews:
MAAS Maintainers (maas-maintainers)
For more details, see:
https://code.launchpad.net/~ack/maas/+git/maas/+merge/433658
--
Your team MAAS Committers is subscribed to branch maas:master.
diff --git a/src/maastesting/pytest/perftest.py b/src/maastesting/pytest/perftest.py
index a5469d4..45749f3 100644
--- a/src/maastesting/pytest/perftest.py
+++ b/src/maastesting/pytest/perftest.py
@@ -57,7 +57,7 @@ def perf(pytestconfig):
with open(output, "w") as f:
perf_tester.finish_build(f)
else:
- perf_tester.finish_build(sys.stdout)
+ perf_tester.finish_build(sys.stdout, format=True)
class Timing:
@@ -95,8 +95,11 @@ class PerfTester:
yield
self.results["tests"][name] = {"duration": timing.duration}
- def finish_build(self, output):
- json.dump(self.results, output)
+ def finish_build(self, output, format=False):
+ params = {"sort_keys": True, "indent": 4} if format else {}
+ if format:
+ output.write("\n")
+ json.dump(self.results, output, **params)
@contextmanager
Follow ups