本文整理汇总了Python中twisted.scripts.trial.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: runTrial
def runTrial(options):
"""Run Twisted trial based unittests, optionally with coverage.
:type options: :class:`~bridgedb.opt.TestOptions`
:param options: Parsed options for controlling the twisted.trial test
run. All unrecognised arguments after the known options will be passed
along to trial.
"""
from twisted.scripts import trial
# Insert 'trial' as the first system cmdline argument:
sys.argv = ['trial']
if options['coverage']:
try:
from coverage import coverage
except ImportError as ie:
print(ie.message)
else:
cov = coverage()
cov.start()
sys.argv.append('--coverage')
sys.argv.append('--reporter=bwverbose')
# Pass all arguments along to its options parser:
if 'test_args' in options:
for arg in options['test_args']:
sys.argv.append(arg)
# Tell trial to test the bridgedb package:
sys.argv.append('bridgedb.test')
trial.run()
if options['coverage']:
cov.stop()
cov.html_report('_trial_temp/coverage/')
开发者ID:gsathya,项目名称:bridgedb,代码行数:35,代码来源:runner.py
示例2: test
def test(so, stdout, stderr):
petmail = os.path.abspath(sys.argv[0])
petmail_executable.append(petmail) # to run bin/petmail in a subprocess
from twisted.scripts import trial as twisted_trial
sys.argv = ["trial"] + so.test_args
twisted_trial.run() # this does not return
sys.exit(0) # just in case
开发者ID:ggozad,项目名称:petmail,代码行数:7,代码来源:runner.py
示例3: run
def run():
"Run the Ibid test suite. Bit of a hack"
from twisted.scripts.trial import run
import sys
sys.argv.append("ibid")
run()
开发者ID:GertBurger,项目名称:ibid,代码行数:7,代码来源:__init__.py
示例4: main
def main():
# init test cases
if len(sys.argv)>1:
test_case = ".".join([__file__.split('.')[0], sys.argv[1]])
else:
test_case = __file__.split('.')[0]
# launch trial
sys.argv = [sys.argv[0], test_case]
trial.run()
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:9,代码来源:unittest_protocols.py
示例5: trial
def trial(config):
sys.argv = ['trial'] + config.trial_args
from allmydata._version import full_version
if full_version.endswith("-dirty"):
print >>sys.stderr
print >>sys.stderr, "WARNING: the source tree has been modified since the last commit."
print >>sys.stderr, "(It is usually preferable to commit, then test, then amend the commit(s)"
print >>sys.stderr, "if the tests fail.)"
print >>sys.stderr
# This does not return.
twisted_trial.run()
开发者ID:ArtRichards,项目名称:tahoe-lafs,代码行数:13,代码来源:debug.py
示例6: test_debuggerNotFound
def test_debuggerNotFound(self):
"""
When a debugger is not found, an error message is printed to the user.
"""
def _makeRunner(*args, **kwargs):
raise trial._DebuggerNotFound('foo')
self.patch(trial, "_makeRunner", _makeRunner)
try:
trial.run()
except SystemExit as e:
self.assertIn("foo", str(e))
else:
self.fail("Should have exited due to non-existent debugger!")
开发者ID:AlexanderHerlan,项目名称:syncpy,代码行数:16,代码来源:test_script.py
示例7: egg_test_runner
def egg_test_runner():
"""
Test collector and runner for setup.py test
"""
from twisted.scripts.trial import run
original_args = list(sys.argv)
sys.argv = ["", "resilience"]
try:
return run()
finally:
sys.argv = original_args
开发者ID:Wallix-Resilience,项目名称:LogMonitor,代码行数:11,代码来源:__init__.py
示例8: _run
def _run(self, test_loc):
"""
Executes the test step.
@param test_loc: location of test module
@type test_loc: str
"""
from twisted.scripts.trial import run
# remove the 'test' option from argv
sys.argv.remove('test')
# Mimick the trial script by adding the path as the last arg
sys.argv.append(test_loc)
# Add the current dir to path and pull it all together
sys.path.insert(0, os.path.curdir)
sys.path[:] = map(os.path.abspath, sys.path)
# GO!
run()
开发者ID:Callek,项目名称:buildbot,代码行数:20,代码来源:setup.py
示例9: _run
def _run(self, test_loc):
"""
Executes the test step.
@param test_loc: location of test module
@type test_loc: str
"""
from twisted.scripts.trial import run
# Mimick the trial script by adding the path as the last arg
sys.argv.append(test_loc)
# No superuser should execute tests
if hasattr(os, "getuid") and os.getuid() == 0:
raise SystemExit('Do not test as a superuser! Exiting ...')
# Add the current dir to path and pull it all together
sys.path.insert(0, os.path.curdir)
sys.path[:] = map(os.path.abspath, sys.path)
# GO!
run()
开发者ID:Flumotion,项目名称:buildbot,代码行数:21,代码来源:setup.py
示例10: run_trial
def run_trial():
from twisted.python import modules
# We monkey patch PythonModule in order to avoid tests inside namespace packages
# being run multiple times (see http://twistedmatrix.com/trac/ticket/5030)
PythonModule = modules.PythonModule
class PatchedPythonModule(PythonModule):
def walkModules(self, *a, **kw):
yielded = set()
# calling super on PythonModule instead of PatchedPythonModule, since we're monkey patching PythonModule
for module in super(PythonModule, self).walkModules(*a, **kw):
if module.name in yielded:
continue
yielded.add(module.name)
yield module
modules.PythonModule = PatchedPythonModule
from twisted.scripts.trial import run
run()
开发者ID:alexbrasetvik,项目名称:Piped,代码行数:22,代码来源:scripts.py
示例11: run
# This is a tiny helper module, to let "python -m allmydata.test.run_trial
# ARGS" does the same thing as running "trial ARGS" (unfortunately
# twisted/scripts/trial.py does not have a '__name__=="__main__"' clause).
#
# This makes it easier to run trial under coverage from tox:
# * "coverage run trial ARGS" is how you'd usually do it
# * but "trial" must be the one in tox's virtualenv
# * "coverage run `which trial` ARGS" works from a shell
# * but tox doesn't use a shell
# So use:
# "coverage run -m allmydata.test.run_trial ARGS"
from twisted.scripts.trial import run
run()
开发者ID:MostAwesomeDude,项目名称:tahoe-lafs,代码行数:15,代码来源:run_trial.py
示例12: test_outbind
@defer.inlineCallbacks
def test_outbind(self):
client = SMPPClientReceiver(self.config, self.msgHandler)
smpp = yield client.connect()
yield smpp.getDisconnectedDeferred()
class SMPPClientServiceBindTimeoutTestCase(SimulatorTestCase):
configArgs = {
'sessionInitTimerSecs': 0.1,
}
def test_bind_transmitter_timeout(self):
client = SMPPClientTransmitter(self.config)
svc = SMPPClientService(client)
stopDeferred = svc.getStopDeferred()
startDeferred = svc.startService()
return defer.DeferredList([
self.assertFailure(startDeferred, SMPPSessionInitTimoutError),
self.assertFailure(stopDeferred, SMPPSessionInitTimoutError),
])
if __name__ == '__main__':
observer = log.PythonLoggingObserver()
observer.start()
logging.basicConfig(level=logging.DEBUG)
import sys
from twisted.scripts import trial
sys.argv.extend([sys.argv[0]])
trial.run()
开发者ID:AlternativeValue-ALVA,项目名称:jasmin,代码行数:30,代码来源:smpp_client_test.py
示例13: trial
def trial(config):
sys.argv = ['trial'] + config.trial_args
# This does not return.
twisted_trial.run()
开发者ID:drewp,项目名称:tahoe-lafs,代码行数:5,代码来源:debug.py
示例14: open
from twisted.scripts import trial
with open(".py3.notworking.txt", "r") as f:
not_working_list = f.read().splitlines()
# Get a list of all the tests by using "trial -n"
trial_output = subprocess.check_output(
"trial -n --reporter=bwverbose buildbot.test | "
"awk '/OK/ {print $1}'", shell=True)
trial_output = trial_output.decode("utf-8")
tests = trial_output.splitlines()
# Filter out the tests which are not working
for test in not_working_list:
try:
tests.remove(test)
except ValueError as e:
print("FAILED TO REMOVE ", test, type(test))
print("\n\nRunning tests with:\n\n", sys.version, "\n\n")
# Run the tests. To avoid "Argument list too long"
# errors, invoke twisted.scripts.trial.run() directly
# instead of invoking the trial script.
sys.argv[0] = "trial"
sys.argv.append("--reporter=bwverbose")
sys.argv += tests
sys.exit(trial.run())
开发者ID:chapuni,项目名称:buildbot,代码行数:29,代码来源:run_py3_working_tests.py
示例15: run
def run(self):
import sys
from twisted.scripts import trial
sys.argv = ["trial", "--rterrors", "foolscap.test"]
trial.run() # does not return
开发者ID:warner,项目名称:foolscap,代码行数:5,代码来源:setup.py
示例16: buttonClick
def buttonClick(self):
if not self.running:
from twisted.scripts import trial
trial.run()
开发者ID:D3f0,项目名称:txscada,代码行数:4,代码来源:test.py
示例17: test
def test(so, stdout, stderr):
from twisted.scripts import trial
sys.argv = ["trial"] + list(so.test_args)
trial.run()
sys.exit(0) # just in case
开发者ID:dckc,项目名称:q-runtime,代码行数:5,代码来源:runner.py
注:本文中的twisted.scripts.trial.run函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论