def test_failure(self): output = StringIO() rep = OutdatedReporter(output, None) # failures of outdated tasks are expected, so nothing happens rep.add_failure(FakeTask("outdated:xxx"), Exception()) # failures on any other task raise error pytest.raises(pytest.UsageError, rep.add_failure, FakeTask("x"), Exception())
def test_failure(self): output = StringIO() rep = OutdatedReporter(output, None) # failures of outdated tasks are expected, so nothing happens rep.add_failure(FakeTask('outdated:xxx'), Exception()) # failures on any other task raise error pytest.raises(pytest.UsageError, rep.add_failure, FakeTask('x'), Exception())
def test_output(self): output = StringIO() rep = OutdatedReporter(output, None) rep.execute_task(FakeTask("foo")) rep.execute_task(FakeTask("outdated:xxx")) rep.execute_task(FakeTask("NOToutdated:abc")) rep.execute_task(FakeTask("outdated:yyy")) rep.complete_run() assert output.getvalue() == '["xxx", "yyy"]'
def test_runtime_error(self): output = StringIO() rep = OutdatedReporter(output, None) pytest.raises(Exception, rep.runtime_error, 'error msg')
def test_output(self): output = StringIO() rep = OutdatedReporter(output, None) rep.execute_task(FakeTask('foo')) rep.execute_task(FakeTask('outdated:xxx')) rep.execute_task(FakeTask('NOToutdated:abc')) rep.execute_task(FakeTask('outdated:yyy')) rep.complete_run() assert output.getvalue() == '["xxx", "yyy"]'