Ejemplo n.º 1
0
def test_user_exceptions_make_pyccuracy_raises_hook_error():
    class BrokenHook(AfterTestsHook):
        def execute(self, results):
            raise Exception("user did stupid things")
    
    Hooks.execute_after_tests(None)
    Hooks.reset()
Ejemplo n.º 2
0
def test_will_register_after_tests_hook():
    class SomeHook(AfterTestsHook):
        def execute(self, result):
            pass

    assert SomeHook in HOOKS['after_tests']
    Hooks.reset()
Ejemplo n.º 3
0
def test_reset_hooks():
    Hooks.reset()
    class AHook(AfterTestsHook):
        def execute(self, results):
            pass
    assert len(HOOKS['after_tests']) == 1
    assert AHook in HOOKS['after_tests']
    Hooks.reset()
    assert len(HOOKS['after_tests']) == 0
Ejemplo n.º 4
0
def test_will_execute_my_hook():
    result_mock = Mock()
    result_mock.expects(once()).method('a_method')
    
    class MyHook(AfterTestsHook):
        def execute(self, result):
            result.a_method()
    
    Hooks.execute_after_tests(result_mock)
    result_mock.verify()
    Hooks.reset()
Ejemplo n.º 5
0
def test_construction_fails_without_implementing_execute():
    class DoNothing(AfterTestsHook):
        pass
    Hooks.reset()