Пример #1
0
 class Module(object):
     unittest.addModuleCleanup(module_cleanup_good,
                               1,
                               2,
                               3,
                               four='hello',
                               five='goodbye')
     unittest.addModuleCleanup(module_cleanup_bad)
Пример #2
0
def setUpModule():
    global signal_blackboard

    signal_blackboard = { signal.SIGUSR1 : {'tripped': 0, 'tripped_by': 0 },
                          signal.SIGUSR2 : {'tripped': 0, 'tripped_by': 0 },
                          signal.SIGALRM : {'tripped': 0, 'tripped_by': 0 } }

    oldsigs = registerSignals(handle_signals, handle_signals, handle_signals)
    unittest.addModuleCleanup(registerSignals, *oldsigs)
Пример #3
0
def setUpModule():
    thread_info = threading_helper.threading_setup()
    unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
    try:
        old_switchinterval = sys.getswitchinterval()
        unittest.addModuleCleanup(sys.setswitchinterval, old_switchinterval)
        sys.setswitchinterval(1e-5)
    except AttributeError:
        pass
Пример #4
0
    def test_enterModuleContext(self):
        cleanups = []

        unittest.addModuleCleanup(cleanups.append, 'cleanup1')
        cm = TestCM(cleanups, 42)
        self.assertEqual(unittest.enterModuleContext(cm), 42)
        unittest.addModuleCleanup(cleanups.append, 'cleanup2')

        unittest.case.doModuleCleanups()
        self.assertEqual(cleanups, ['enter', 'cleanup2', 'exit', 'cleanup1'])
Пример #5
0
 def setUpModule():
     ordering.append('setUpModule')
     unittest.addModuleCleanup(cleanup1)
Пример #6
0
def setUpModule():
    thread_info = threading_helper.threading_setup()
    unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
Пример #7
0
 def setUpModule():
     ordering.append('setUpModule2')
     unittest.addModuleCleanup(cleanup, ordering)
     if blowUp2:
         raise Exception()
Пример #8
0
 def setUpModule():
     ordering.append('setUpModule')
     unittest.addModuleCleanup(cleanup, ordering, blowUp=True)
     if module_blow_up:
         raise Exception('ModuleExc')
Пример #9
0
 def setUpModule():
     ordering.append('setUpModule')
     unittest.addModuleCleanup(cleanup, ordering, blowUp=True)
     if module_blow_up:
         raise Exception('ModuleExc')
Пример #10
0
 class Module(object):
     unittest.addModuleCleanup(cleanup, 1, 2, function='hello')
     with self.assertRaises(TypeError):
         unittest.addModuleCleanup(function=cleanup, arg='hello')
     with self.assertRaises(TypeError):
         unittest.addModuleCleanup()
Пример #11
0
 def setUpModule():
     ordering.append('setUpModule')
     unittest.addModuleCleanup(cleanup, ordering, blowUp=blowUp)
Пример #12
0
 def setUpModule():
     print('set up module')
     unittest.addModuleCleanup(bad_cleanup1)
     unittest.addModuleCleanup(bad_cleanup2)
Пример #13
0
 def setUpModule():
     ordering.append('setUpModule2')
     unittest.addModuleCleanup(cleanup, ordering)
     if blowUp2:
         raise Exception()
Пример #14
0
def setUpModule():
    thread_info = support.threading_setup()
    unittest.addModuleCleanup(support.threading_cleanup, *thread_info)
Пример #15
0
                          json=calldict)
        result = r.json()
        print(result)
        self.assertEqual(result["success"], "yes")
        # remove participant from event
        print("remove participant")
        calldict = {
            "token": token,
            "eventid": eventid,
            "participantid": participantid
        }
        r = requests.post('http://localhost:8080/api/remove_participant',
                          json=calldict)
        result = r.json()
        print(result)
        self.assertEqual(result["success"], "yes")
        # delete event
        print("remove event")
        calldict = {"token": token, "eventid": eventid}
        r = requests.post('http://localhost:8080/api/delete_event',
                          json=calldict)
        result = r.json()
        print(result)
        self.assertEqual(result["success"], "yes")


unittest.addModuleCleanup(tearDownModule)

if __name__ == '__main__':
    unittest.main()
Пример #16
0
 def setUpModule():
     ordering.append('setUpModule')
     unittest.addModuleCleanup(cleanup1)
Пример #17
0
def setUpModule():
    cm = warnings.catch_warnings()
    cm.__enter__()
    unittest.addModuleCleanup(cm.__exit__, None, None, None)
    warnings.filterwarnings("error", module="<test string>")