def test_basic(self): """A basic sanity test with nothing tricky.""" test = PiglitBaseTest(['foo']) test.result.out = 'PIGLIT: {"result": "pass"}\n' test.result.returncode = 0 test.interpret_result() assert test.result.result is status.PASS
def test_piglittest_interpret_result(): """test.piglit_test.PiglitBaseTest.interpret_result(): works no subtests""" test = PiglitBaseTest(['foo']) test.result['out'] = 'PIGLIT: {"result": "pass"}\n' test.result['returncode'] = 0 test.interpret_result() nt.eq_(test.result['result'], 'pass')
def test_piglittest_interpret_result(): """test.piglit_test.PiglitBaseTest.interpret_result(): works with no subtests""" test = PiglitBaseTest(['foo']) test.result.out = 'PIGLIT: {"result": "pass"}\n' test.result.returncode = 0 test.interpret_result() nt.eq_(test.result.result, 'pass')
def test_piglittest_interpret_result_subtest(): """ PiglitBaseTest.interpret_result() works with subtests """ test = PiglitBaseTest(['foo']) test.result['out'] = ('PIGLIT: {"result": "pass"}\n' 'PIGLIT: {"subtest": {"subtest": "pass"}}\n') test.interpret_result() assert test.result['subtest']['subtest'] == 'pass'
def test_piglittest_interpret_result_subtest(): """test.piglit_test.PiglitBaseTest.interpret_result(): works with subtests""" test = PiglitBaseTest(['foo']) test.result['out'] = ('PIGLIT: {"result": "pass"}\n' 'PIGLIT: {"subtest": {"subtest": "pass"}}\n') test.result['returncode'] = 0 test.interpret_result() nt.eq_(test.result['subtest']['subtest'], 'pass')
def test_piglittest_interpret_result_subtest(): """test.piglit_test.PiglitBaseTest.interpret_result(): works with subtests""" test = PiglitBaseTest(['foo']) test.result.out = ('PIGLIT: {"result": "pass"}\n' 'PIGLIT: {"subtest": {"subtest": "pass"}}\n') test.result.returncode = 0 test.interpret_result() nt.eq_(test.result.subtests['subtest'], 'pass')
def test_with_subtests(self): """works with one subtest.""" test = PiglitBaseTest(['foo']) test.result.out = textwrap.dedent("""\ PIGLIT: {"result": "pass"} PIGLIT: {"subtest": {"subtest": "pass"}}""") test.result.returncode = 0 test.interpret_result() assert test.result.subtests['subtest'] is status.PASS
def test_piglitest_no_clobber(): """test.piglit_test.PiglitBaseTest.interpret_result(): does not clobber subtest entires""" test = PiglitBaseTest(['a', 'command']) test.result.out = ( 'PIGLIT: {"result": "pass"}\n' 'PIGLIT: {"subtest": {"test1": "pass"}}\n' 'PIGLIT: {"subtest": {"test2": "pass"}}\n' ) test.result.returncode = 0 test.interpret_result() nt.eq_(test.result.subtests, {'test1': 'pass', 'test2': 'pass'})
def test_piglitest_no_clobber(): """ PiglitBaseTest.interpret_result() does not clobber subtest entires """ test = PiglitBaseTest(['a', 'command']) test.result['out'] = ( 'PIGLIT: {"result": "pass"}\n' 'PIGLIT: {"subtest": {"test1": "pass"}}\n' 'PIGLIT: {"subtest": {"test2": "pass"}}\n' ) test.interpret_result() nt.assert_dict_equal(test.result['subtest'], {'test1': 'pass', 'test2': 'pass'})
def test_with_multiple_subtests(self): """Works with multiple subtests. Including that it doesn't only take the last subtest, but counts all of them. """ test = PiglitBaseTest(['a', 'command']) test.result.out = textwrap.dedent("""\ PIGLIT: {"result": "pass"} PIGLIT: {"subtest": {"test1": "pass"}} PIGLIT: {"subtest": {"test2": "pass"}}""") test.result.returncode = 0 test.interpret_result() assert dict(test.result.subtests) == \ {'test1': 'pass', 'test2': 'pass'}
def test_stdout(self): """Separates the actual stdout printing from the PIGLIT protocol. """ test = PiglitBaseTest(['foo']) test.result.out = textwrap.dedent("""\ This is output more output PIGLIT: {"result": "pass"} and stuff""") test.result.returncode = 0 test.interpret_result() assert test.result.result is status.PASS assert test.result.out == textwrap.dedent("""\ This is output more output and stuff""")
def test_piglittest_interpret_result(): """ PiglitBaseTest.interpret_result() works no subtests """ test = PiglitBaseTest(['foo']) test.result['out'] = 'PIGLIT: {"result": "pass"}\n' test.interpret_result() assert test.result['result'] == 'pass'