From a3f7113b96aa5576ee15df8155cc0d056e8efb5a Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 22 Jun 2017 15:03:08 -0700 Subject: framework: Fix the same bug for resume in the previous commit The resume path duplicates the 2 lines of code, so the same fix is required there. Signed-off-by: Dylan Baker --- unittests/framework/backends/test_json.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'unittests') diff --git a/unittests/framework/backends/test_json.py b/unittests/framework/backends/test_json.py index 94d8fbf54..ccf445747 100644 --- a/unittests/framework/backends/test_json.py +++ b/unittests/framework/backends/test_json.py @@ -202,13 +202,11 @@ class TestResume(object): assert set(test.tests.keys()) == \ {'group1/test1', 'group1/test2', 'group2/test3'} - @pytest.mark.xfail - def test_load_invalid_folder(self, tmpdir): - """backends.json._resume: ignores invalid results""" - # XXX: I'm not sure if this test is worth fixing or not, it would - # involve a lot of code, and for this case to actually be tripped a - # user would have to write a file into the tests directory that isn't a - # number + def test_load_invalid_ext(self, tmpdir): + """backends.json._resume: ignores invalid results extensions. + + This gets triggered by an incomplete atomic write + """ f = six.text_type(tmpdir) backend = backends.json.JSONBackend(f) backend.initialize(shared.INITIAL_METADATA) @@ -218,13 +216,14 @@ class TestResume(object): t(results.TestResult('pass')) with backend.write_test("group2/test3") as t: t(results.TestResult('fail')) - with open(os.path.join(f, 'tests', 'x.json'), 'w') as w: + with open(os.path.join(f, 'tests', '3.json.tmp'), 'w') as w: w.write('foo') test = backends.json._resume(f) assert set(test.tests.keys()) == \ {'group1/test1', 'group1/test2', 'group2/test3'} + def test_load_incomplete(self, tmpdir): """backends.json._resume: loads incomplete results. -- cgit v1.2.3