diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-06-22 15:03:08 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-07-21 15:15:55 -0700 |
commit | a3f7113b96aa5576ee15df8155cc0d056e8efb5a (patch) | |
tree | b4ac5d2fb87d4db6d407288cbcce7d487ac093be /unittests | |
parent | fe3251bbdde4e2d2d3c3d83a23700de40ba496f7 (diff) |
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 <dylanx.c.baker@intel.com>
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/framework/backends/test_json.py | 15 |
1 files changed, 7 insertions, 8 deletions
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. |