# -*- coding: utf-8 -*- import sys import os.path ROOT_DIR = os.path.normpath( os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), os.pardir)) sys.path.append(ROOT_DIR) import pausable_unittest import testpauser import pausable_unittest.dummypauser import time import re class PauserTest(pausable_unittest.TestCase): def test_pauser(self): self.assertFalse( hasattr(self, "exec_for_reboot"), "method for testpauser should not copied to TestCase") if __name__ == "__main__": dummy = pausable_unittest.dummypauser.Pauser() test = testpauser.Pauser() pausable_unittest.main(dummy)
# -*- coding: utf-8 -*- import sys import os.path ROOT_DIR = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), os.pardir)) sys.path.append(ROOT_DIR) import pausable_unittest import pausable_unittest.simplerunner as simplerunner import testpauser import pausable_unittest.dummypauser def simple_test(pauser): pauser.assertTrue(True, "simple_test") pauser.reboot() pauser.assertTrue(True, "simple_test 2") if __name__ == "__main__": simplerunner.main(simple_test, testpauser.Pauser())
# -*- coding: utf-8 -*- import sys import os.path ROOT_DIR = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), os.pardir)) sys.path.append(ROOT_DIR) import pausable_unittest import testpauser import time class FailureTest(pausable_unittest.TestCase): def test_failure_exec_for_reboot(self): self.exec_for_reboot("invalid_command") if __name__ == "__main__": pausable_unittest.main(testpauser.Pauser())
# -*- coding: utf-8 -*- import sys import os.path ROOT_DIR = os.path.normpath( os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), os.pardir)) sys.path.append(ROOT_DIR) import pausable_unittest import testpauser import time import re class ExecCallbackTest(pausable_unittest.TestCase): def test_exec_callback(self): self.assertEqual(self.bat_path("base"), "base_sample", "bat_path should return XXX_sample") try: self.create_bat() except: self.assertFalse("create_bat should not raise any errors.") if __name__ == "__main__": pauser = testpauser.Pauser() pausable_unittest.main(pauser)