本文整理汇总了Python中tests.main函数的典型用法代码示例。如果您正苦于以下问题:Python main函数的具体用法?Python main怎么用?Python main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了main函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
def run(self):
from tests import main
main(
test_names = self.tests,
print_only = self.print_only,
coverage = self.coverage,
)
示例2: main
def main():
MenuDev()
core_api.bind_to_exit_app_1(simulator.stop)
tests.main()
示例3: id
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()
示例4: test_0003_orig_digests
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()
示例5: canReadGlobalCfgFile
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)
示例6: run
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)
示例7: 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)
示例9: close_db
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__)