[Piglit] [RESEND PATCH 2/4] framework/tests/json_results_update_tests.py: make test more robust

dylanx.c.baker at intel.com dylanx.c.baker at intel.com
Thu Oct 8 11:46:09 PDT 2015


From: Dylan Baker <baker.dylan.c at gmail.com>

This makes the test that tries to run a version 1 result to <current
version> more robust by always trying to update to whatever the latest
is.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/tests/json_results_update_tests.py | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/framework/tests/json_results_update_tests.py b/framework/tests/json_results_update_tests.py
index 9ae1102..f89d65f 100644
--- a/framework/tests/json_results_update_tests.py
+++ b/framework/tests/json_results_update_tests.py
@@ -278,6 +278,18 @@ class TestV0toV1(object):
             with open(t, 'r') as f:
                 backends.json._update_zero_to_one(backends.json._load(f))
 
+    @utils.DocFormatter({'current': backends.json.CURRENT_JSON_VERSION})
+    def test_load_results(self):
+        """backends.json.update_results (1 -> {current}): load_results properly updates"""
+        with utils.tempdir() as d:
+            tempfile = os.path.join(d, 'results.json')
+            with open(tempfile, 'w') as f:
+                json.dump(self.DATA, f, default=backends.json.piglit_encoder)
+            with open(tempfile, 'r') as f:
+                result = backends.json.load_results(tempfile, 'none')
+                nt.eq_(result.results_version,
+                       backends.json.CURRENT_JSON_VERSION)
+
 
 class TestV2Update(object):
     """Test V1 to V2 of results."""
@@ -740,12 +752,3 @@ class TestV6toV7(object):
         """backends.json.update_results (6 -> 7): Totals are populated"""
         nt.ok_(self.result.totals != {})
 
-    def test_load_results(self):
-        """backends.json.update_results (6 -> 7): load_results properly updates."""
-        with utils.tempdir() as d:
-            tempfile = os.path.join(d, 'results.json')
-            with open(tempfile, 'w') as f:
-                json.dump(self.DATA, f, default=backends.json.piglit_encoder)
-            with open(tempfile, 'r') as f:
-                result = backends.json.load_results(tempfile, 'none')
-                nt.eq_(result.results_version, 7)
-- 
2.6.1



More information about the Piglit mailing list