def test_not_callable(self): """ An importable, but not-callable-object also raises an InitializerOrFinalizerError. """ initializer = InitializerOrFinalizer('green.test.test_runner.non_callable') self.assertRaises(InitializerOrFinalizerError, initializer)
def test_blank(self): """ Given a blank dotted function, calling the initializer/finalizer does nothing. """ initializer = InitializerOrFinalizer('') initializer()
def test_importable(self): """ Given an actual importable module and function, the function is run. """ global importable_function_worked importable_function_worked = False InitializerOrFinalizer('green.test.test_runner._importableFunction')() self.assertTrue(importable_function_worked)
def test_crash(self): """ An importable, callable object...crashes. """ initializer = InitializerOrFinalizer('green.test.test_runner._crashy') self.assertRaises(InitializerOrFinalizerError, initializer)
def test_unimportable(self): """ Given an unimportable module, an InitializerOrFinalizerError is raised. """ initializer = InitializerOrFinalizer('garbagejunk.nonexistant') self.assertRaises(InitializerOrFinalizerError, initializer)