def test_info_split(): """ Version 1: info can split into any number of elements """ data = copy.copy(DATA) data['tests']['sometest']['info'] = \ 'Returncode: 1\n\nErrors:stderr\n\nOutput: stdout\n\nmore\n\nstuff' with utils.with_tempfile(json.dumps(data)) as f: results._update_zero_to_one(results.load_results(f))
'group3/groupA/test': { 'info': 'Returncode: 1\n\nErrors:stderr\n\nOutput:stdout\n', 'subtest': { 'subtest 1': 'pass', 'subtest 2': 'pass', 'subtest 3': 'pass', }, 'returncode': 0, 'command': 'this is a command', 'result': 'pass', 'time': 0.1 }, }) with utils.with_tempfile(json.dumps(DATA)) as f: RESULT = results._update_zero_to_one(results.load_results(f)) def test_dmesg(): """ version 1: dmesg is converted from a list to a string """ assert RESULT.tests['sometest']['dmesg'] == 'this\nis\ndmesg' def test_subtests_remove_duplicates(): """ Version 1: Removes duplicate entries """ assert 'group1/groupA/test/subtest 1' not in RESULT.tests assert 'group1/groupA/test/subtest 2' not in RESULT.tests def test_subtests_add_test(): """ Version 1: Add an entry for the actual test """
'info': 'Returncode: 1\n\nErrors:stderr\n\nOutput:stdout\n', 'subtest': { 'subtest 1': 'pass', 'subtest 2': 'pass', 'subtest 3': 'pass', }, 'returncode': 0, 'command': 'this is a command', 'result': 'pass', 'time': 0.1 }, }) with utils.with_tempfile(json.dumps(DATA)) as t: with open(t, 'r') as f: RESULT = results._update_zero_to_one(results.TestrunResult.load(f)) def test_dmesg(): """ version 1: dmesg is converted from a list to a string """ assert RESULT.tests['sometest']['dmesg'] == 'this\nis\ndmesg' def test_subtests_remove_duplicates(): """ Version 1: Removes duplicate entries """ assert 'group1/groupA/test/subtest 1' not in RESULT.tests assert 'group1/groupA/test/subtest 2' not in RESULT.tests def test_subtests_add_test(): """ Version 1: Add an entry for the actual test """