def run(self): from tests import main main( test_names=self.tests, print_only=self.print_only, coverage=self.coverage, )
def run(self): from tests import main main( test_names = self.tests, print_only = self.print_only, coverage = self.coverage, )
def run(self): from tests import main testprogram = main(module=None, argv=sys.argv[:1], verbosity=2, exit=False) if not testprogram.result.wasSuccessful(): sys.exit(1)
def canPassTest(): runTest("pkgtest.passing.test.py", "PASSED A passing test") def canFailTest(): runTest("pkgtest.failed.test.py", "FAILED A failing test") def canMarkTestAsInconclusuve(): runTest("pkgtest.inconclusive.test.py", "?????? A inconclusive test") def runTest(testfile, expectedcoutput): root = os.path.dirname(__file__) passed = False for line in runProcess( ["oi", "package", "test", os.path.join(root, testfile)]): if expectedcoutput in line: passed = True if passed == False: tests.out("failed") else: tests.out("passed") if __name__ == "__main__": tests.main("initialized", getTests)
""" + self.epilogue) output, lines = self.launch_subprocess('newmod') self.assertEqual(len(lines), 3, "\n".join(lines)) self.assertEqual(lines[0], lines[1]) def test_is_alive(self): self.write_to_tempfile( "newmod", self.prologue + """ print(t.is_alive()) print(t.isAlive()) """ + self.epilogue) output, lines = self.launch_subprocess('newmod') self.assertEqual(len(lines), 3, "\n".join(lines)) self.assertEqual(lines[0], "True", lines[0]) self.assertEqual(lines[1], "True", lines[1]) def test_is_daemon(self): self.write_to_tempfile( "newmod", self.prologue + """ print(t.is_daemon()) print(t.isDaemon()) """ + self.epilogue) output, lines = self.launch_subprocess('newmod') self.assertEqual(len(lines), 3, "\n".join(lines)) self.assertEqual(lines[0], "True", lines[0]) self.assertEqual(lines[1], "True", lines[1]) if __name__ == '__main__': main()
def main(): MenuDev() core_api.bind_to_exit_app_1(simulator.stop) tests.main()
print id(t._g) print t.ident """ + self.epilogue) output, lines = self.launch_subprocess('newmod') self.assertEqual(len(lines), 3, "\n".join(lines)) self.assertEqual(lines[0], lines[1]) def test_is_alive (self): self.write_to_tempfile("newmod", self.prologue + """ print t.is_alive() print t.isAlive() """ + self.epilogue) output, lines = self.launch_subprocess('newmod') self.assertEqual(len(lines), 3, "\n".join(lines)) self.assertEqual(lines[0], "True", lines[0]) self.assertEqual(lines[1], "True", lines[1]) def test_is_daemon (self): self.write_to_tempfile("newmod", self.prologue + """ print t.is_daemon() print t.isDaemon() """ + self.epilogue) output, lines = self.launch_subprocess('newmod') self.assertEqual(len(lines), 3, "\n".join(lines)) self.assertEqual(lines[0], "True", lines[0]) self.assertEqual(lines[1], "True", lines[1]) if __name__ == '__main__': main()
#!/usr/bin/env python3 import mmse15project import tests #tests should always be run before the program starts print("> run tests") tests.main() print("> run mmse15project") mmse15project.main()
self.assertItemsEqual( [entry.target for entry in self.loaded_pdarchive.patches], [entry.target for entry in self.pdarchive.patches]) def test_0003_orig_digests(self): '''Compare `orig_digest` values for each entry''' self.assertItemsEqual( [entry.orig_digest for entry in self.loaded_pdarchive.patches], [entry.orig_digest for entry in self.pdarchive.patches]) def test_0003_dest_digests(self): '''Compare `dest_digest` values for each entry''' self.assertItemsEqual( [entry.dest_digest for entry in self.loaded_pdarchive.patches], [entry.dest_digest for entry in self.pdarchive.patches]) def test_0004_apply_archive(self): '''Apply loaded pdar file and validate results - clone original dataset - apply loaded pdar file to cloned dataset - filecmp.cmpfiles against destination dataset ''' self._test_apply_pdarchive(self.loaded_pdarchive) if __name__ == "__main__": tests.main()
cnx.commit() # Placed outside of commit to avoid queue lock, if any. q.put(cursor.lastrowid) close_db(cursor, cnx) a_queue = Queue() Process(target=run_session_a, args=(a_queue,)).start() assert 'A Started' == a_queue.get() # blocking call b_queue = Queue() Process(target=run_session_b, args=(b_queue,)).start() assert 'B Started' == b_queue.get() # blocking call # Session sync counts, a is issued before b. a_session_sc = a_queue.get() b_session_sc = b_queue.get() print 'a session_sc =', a_session_sc.sync_count print 'b session_sc =', b_session_sc.sync_count assert a_session_sc.sync_count < b_session_sc.sync_count # Product rowid, a is inserted after b. a_product_rowid = a_queue.get() b_product_rowid = b_queue.get() assert a_product_rowid > b_product_rowid # Run main when commands read either from standard input, # from a script file, or from an interactive prompt. if __name__ == "__main__": main(__file__)
tests.out("command|conf test.globalsetting -g -d") tests.out("command|conf test.globalsetting=20 -g") tests.out("command|conf read -g") tests.assertOn(tests.hasOutput("test.globalsetting=20")) tests.out("command|conf test.globalsetting -g -d") def canReadGlobalCfgFile(): root = tests.get("applocation") file = os.path.join(os.path.join(root, ".OpenIDE"), "oi.config") tests.out("command|conf read cfgfile -g") tests.assertOn(tests.hasOutput(file)) def canReadGlobalCfgPoint(): cfgfile = os.path.join(tests.get("applocation"), ".OpenIDE") tests.out("command|conf read cfgpoint -g") tests.assertOn(tests.hasOutput(cfgfile)) def canReadGlobalRootPoint(): root = tests.get("applocation") tests.out("command|conf read rootpoint -g") tests.assertOn(tests.hasOutput(root)) def canRemoveGlobalSetting(): tests.out("command|conf test.globalremovedsetting=34 -g") tests.out("command|conf test.globalremovedsetting -g -d") tests.out("command|conf read -g") tests.assertOn(tests.hasOutput("test.globalremovedsetting=34") == False) if __name__ == "__main__": tests.main("initialized", getTests)
#!/usr/bin/env python import sys import os sys.path.append(os.path.dirname(__file__)) import tests def getTests(): return { "When running the touch command a file should be created and a goto event should be emitted": canRunTouch } def canRunTouch(): tests.out("command|touch bleh.txt") result = False file = os.path.join(sys.argv[1], "bleh.txt") event = "goto \"" + file + "|0|0\"" result = tests.hasEvent(event) if result: result = os.path.exists(file) tests.assertOn(result) if __name__ == "__main__": tests.main("initialized|editor", getTests)
#!/usr/bin/env python import sys import os sys.path.append(os.path.dirname(__file__)) import tests def getTests(): return { "When running the touch command a file should be created and a goto event should be emitted": canRunTouch } def canRunTouch(): tests.out("command|touch bleh.txt") result = False file = os.path.join(sys.argv[1], "bleh.txt") event = "goto '" + file + "|0|0'" result = tests.hasEvent(event) if result: result = os.path.exists(file) tests.assertOn(result) if __name__ == "__main__": tests.main("initialized|editor", getTests)
import tests exit(tests.main())
def run(self): from tests import main main()