示例#1
0
 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)
示例#2
0
 def test_blank(self):
     """
     Given a blank dotted function, calling the initializer/finalizer does
     nothing.
     """
     initializer = InitializerOrFinalizer('')
     initializer()
示例#3
0
 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)
示例#4
0
 def test_crash(self):
     """
     An importable, callable object...crashes.
     """
     initializer = InitializerOrFinalizer('green.test.test_runner._crashy')
     self.assertRaises(InitializerOrFinalizerError, initializer)
示例#5
0
 def test_unimportable(self):
     """
     Given an unimportable module, an InitializerOrFinalizerError is raised.
     """
     initializer = InitializerOrFinalizer('garbagejunk.nonexistant')
     self.assertRaises(InitializerOrFinalizerError, initializer)