def test_logreport_to_testresult_with_extratext():
    report = standard_logreport_output()
    report['longrepr'] = 'long msg'
    expected = TestResult(Category.OK, 'passed', 'foo.bar', time=42,
                          extra_text='long msg',
                          filename=osp.join('ham', 'foo.py'), lineno=24)
    assert logreport_to_testresult(report, 'ham') == expected
def test_logreport_to_testresult_with_message():
    report = standard_logreport_output()
    report['message'] = 'msg'
    expected = TestResult(Category.OK, 'passed', 'foo.bar', message='msg',
                          time=42, filename=osp.join('ham', 'foo.py'),
                          lineno=24)
    assert logreport_to_testresult(report, 'ham') == expected
def test_logreport_to_testresult_skipped():
    report = standard_logreport_output()
    report['when'] = 'setup'
    report['outcome'] = 'skipped'
    report['longrepr'] = ('file', 24, 'skipmsg')
    expected = TestResult(Category.SKIP, 'skipped', 'foo.bar',
                          time=42, extra_text='skipmsg',
                          filename=osp.join('ham', 'foo.py'), lineno=24)
    assert logreport_to_testresult(report, Config(wdir='ham')) == expected
def test_logreport_to_testresult_failed():
    report = standard_logreport_output()
    report['outcome'] = 'failed'
    report['message'] = 'msg'
    report['longrepr'] = 'exception text'
    expected = TestResult(Category.FAIL, 'failure', 'foo.bar',
                          message='msg', time=42, extra_text='exception text',
                          filename=osp.join('ham', 'foo.py'), lineno=24)
    assert logreport_to_testresult(report, Config(wdir='ham')) == expected
Beispiel #5
0
def test_logreport_to_testresult_passed():
    report = standard_logreport_output()
    expected = TestResult(Category.OK,
                          'ok',
                          'foo.bar',
                          time=42,
                          filename=osp.join('ham', 'foo.py'),
                          lineno=24)
    assert logreport_to_testresult(report, Config(wdir='ham')) == expected
def test_logreport_to_testresult_with_outcome_and_possible_error(outcome,
                                                                 witherror,
                                                                 category):
    report = standard_logreport_output()
    report['outcome'] = outcome
    report['witherror'] = witherror
    expected = TestResult(category, outcome, 'foo.bar', time=42,
                          filename=osp.join('ham', 'foo.py'), lineno=24)
    assert logreport_to_testresult(report, 'ham') == expected
def test_logreport_to_testresult_with_output():
    report = standard_logreport_output()
    report['sections'] = [['Captured stdout call', 'ham\n'],
                          ['Captured stderr call', 'spam\n']]
    txt = ('----- Captured stdout call -----\nham\n'
           '----- Captured stderr call -----\nspam\n')
    expected = TestResult(Category.OK, 'ok', 'foo.bar', time=42,
                          extra_text=txt, filename=osp.join('ham', 'foo.py'),
                          lineno=24)
    assert logreport_to_testresult(report, Config(wdir='ham')) == expected
def test_logreport_to_testresult_with_output(longrepr, prefix):
    report = standard_logreport_output()
    report['longrepr'] = longrepr
    report['sections'] = [['Captured stdout call', 'ham\n'],
                          ['Captured stderr call', 'spam\n']]
    txt = (longrepr + prefix +
           '----- Captured stdout call -----\nham\n'
           '----- Captured stderr call -----\nspam\n')
    expected = TestResult(Category.OK, 'passed', 'foo.bar', time=42,
                          extra_text=txt, filename=osp.join('ham', 'foo.py'),
                          lineno=24)
    assert logreport_to_testresult(report, 'ham') == expected
Beispiel #9
0
def test_logreport_to_testresult_skipped():
    report = standard_logreport_output()
    report['when'] = 'setup'
    report['outcome'] = 'skipped'
    report['longrepr'] = ('file', 24, 'skipmsg')
    expected = TestResult(Category.SKIP,
                          'skipped',
                          'foo.bar',
                          time=42,
                          extra_text='skipmsg',
                          filename=osp.join('ham', 'foo.py'),
                          lineno=24)
    assert logreport_to_testresult(report, Config(wdir='ham')) == expected
Beispiel #10
0
def test_logreport_to_testresult_with_output():
    report = standard_logreport_output()
    report['sections'] = [['Captured stdout call', 'ham\n'],
                          ['Captured stderr call', 'spam\n']]
    txt = ('----- Captured stdout call -----\nham\n'
           '----- Captured stderr call -----\nspam\n')
    expected = TestResult(Category.OK,
                          'ok',
                          'foo.bar',
                          time=42,
                          extra_text=txt,
                          filename=osp.join('ham', 'foo.py'),
                          lineno=24)
    assert logreport_to_testresult(report, Config(wdir='ham')) == expected
Beispiel #11
0
def test_logreport_to_testresult_failed():
    report = standard_logreport_output()
    report['outcome'] = 'failed'
    report['message'] = 'msg'
    report['longrepr'] = 'exception text'
    expected = TestResult(Category.FAIL,
                          'failure',
                          'foo.bar',
                          message='msg',
                          time=42,
                          extra_text='exception text',
                          filename=osp.join('ham', 'foo.py'),
                          lineno=24)
    assert logreport_to_testresult(report, Config(wdir='ham')) == expected
def test_logreport_to_testresult_xpass():
    report = standard_logreport_output()
    report['wasxfail'] = ''
    expected = TestResult(Category.OK, 'ok', 'foo.bar', time=42,
                          filename=osp.join('ham', 'foo.py'), lineno=24)
    assert logreport_to_testresult(report, Config(wdir='ham')) == expected