From 97b9d2ddd95d5e6b7ae3a2aa089b360bee428039 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 24 Aug 2016 15:14:01 -0700 Subject: framework: Bump JSON on disk format to version 9 This change makes the TestResult.pid field into a list of ints instead of a list. This will be used by the multiple test per process tests to ensure that all PIDs are recorded when the cherry features is invoked. This is groundwork for later patches in the series. Signed-off-by: Dylan Baker --- framework/backends/json.py | 18 +++++++++++++++++- framework/results.py | 2 +- framework/test/base.py | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) (limited to 'framework') diff --git a/framework/backends/json.py b/framework/backends/json.py index 69f531936..f279f2fb6 100644 --- a/framework/backends/json.py +++ b/framework/backends/json.py @@ -53,7 +53,7 @@ __all__ = [ ] # The current version of the JSON results -CURRENT_JSON_VERSION = 8 +CURRENT_JSON_VERSION = 9 # The level to indent a final file INDENT = 4 @@ -339,6 +339,7 @@ def _update_results(results, filepath): 5: _update_five_to_six, 6: _update_six_to_seven, 7: _update_seven_to_eight, + 8: _update_eight_to_nine, } while results.results_version < CURRENT_JSON_VERSION: @@ -636,6 +637,21 @@ def _update_seven_to_eight(result): return result +def _update_eight_to_nine(result): + """Update json results from version 8 to 9. + + This changes the PID feild of the TestResult object to alist of Integers or + null rather than a single integer or null. + + """ + for test in compat.viewvalues(result.tests): + test.pid = [test.pid] + + result.results_version = 9 + + return result + + REGISTRY = Registry( extensions=['', '.json'], backend=JSONBackend, diff --git a/framework/results.py b/framework/results.py index 756d26109..f9ddcb4cd 100644 --- a/framework/results.py +++ b/framework/results.py @@ -162,7 +162,7 @@ class TestResult(object): self.images = None self.traceback = None self.exception = None - self.pid = None + self.pid = [] if result: self.result = result else: diff --git a/framework/test/base.py b/framework/test/base.py index 63fcaf4c4..b667b1569 100644 --- a/framework/test/base.py +++ b/framework/test/base.py @@ -322,7 +322,7 @@ class Test(object): universal_newlines=True, **_EXTRA_POPEN_ARGS) - self.result.pid = proc.pid + self.result.pid.append(proc.pid) if not _SUPPRESS_TIMEOUT: out, err = proc.communicate(timeout=self.timeout) else: -- cgit v1.2.3