Skip to content

Commit 8b5a89e

Browse files
authored
Merge pull request #31 from vpipkt/feat/duration-json-pretty
Pretty print test duration artifact
2 parents f1cb999 + 2504f0a commit 8b5a89e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/pytest_split/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def pytest_sessionfinish(self) -> None:
214214
self.cached_durations[k] = v
215215

216216
with open(self.config.option.durations_path, "w") as f:
217-
json.dump(self.cached_durations, f)
217+
json.dump(self.cached_durations, f, sort_keys=True, indent=4)
218218

219219
message = self.writer.markup(
220220
"\n\n[pytest-split] Stored test durations in {}".format(self.config.option.durations_path)

tests/test_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def test_it_stores(self, example_suite, durations_path):
3030

3131
assert list(durations.keys()) == [
3232
"test_it_stores.py::test_1",
33+
"test_it_stores.py::test_10",
3334
"test_it_stores.py::test_2",
3435
"test_it_stores.py::test_3",
3536
"test_it_stores.py::test_4",
@@ -38,7 +39,6 @@ def test_it_stores(self, example_suite, durations_path):
3839
"test_it_stores.py::test_7",
3940
"test_it_stores.py::test_8",
4041
"test_it_stores.py::test_9",
41-
"test_it_stores.py::test_10",
4242
]
4343

4444
for duration in durations.values():

0 commit comments

Comments
 (0)