本文整理汇总了Python中yotta.test.cli.cli.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: generatedTestMethod
def generatedTestMethod(self):
test_dir = util.writeTestFiles(filesForReporterTest(**kwargs), test_dir=self.test_dir)
# build first, to make test timing more accurate:
stdout, stderr, statuscode = cli.run(['--target', systemDefaultTarget(), 'build'], cwd=test_dir)
#print('build:', stdout)
#print('build:', stderr)
#print('build statuscode was:', statuscode)
self.assertEqual(statuscode, 0)
tstart = time.time()
stdout, stderr, statuscode = cli.run(['-vvv', '--target', systemDefaultTarget(), 'test'], cwd=test_dir)
duration = time.time() - tstart
# useful output for debugging failed tests:
if bool(statuscode) == bool(kwargs['test_passes']) or \
duration >= 5.5 + kwargs['reporter_waits'] or \
(kwargs['test_speed'] == 'fast' and (duration >= 1.5 + kwargs['reporter_waits'])):
print(stdout + stderr)
print(statuscode)
print('duration:', duration)
if kwargs['test_passes']:
self.assertEqual(statuscode, 0)
else:
self.assertNotEqual(statuscode, 0)
# **no** tests should cause a timeout (Which is set at 4.5 seconds in
# the test reporter), + the wait-for duration (+ 1 second slack for
# process startup etc.)
self.assertTrue(duration < 5.5 + kwargs['reporter_waits'])
# if a test isn't slow, then it should run in less than 1 seconds
if kwargs['test_speed'] == 'fast':
self.assertTrue(duration < 1.5 + kwargs['reporter_waits'])
开发者ID:ARMmbed,项目名称:yotta,代码行数:35,代码来源:test_test.py
示例2: testUnlinkTargetGlobally
def testUnlinkTargetGlobally(self):
test_target = util.writeTestFiles(util.getNativeTargetDescription(), True)
stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'link-target'], cwd=test_target)
self.assertEqual(statuscode, 0)
stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'unlink-target'], cwd=test_target)
self.assertEqual(statuscode, 0)
util.rmRf(test_target)
开发者ID:ARMmbed,项目名称:yotta,代码行数:7,代码来源:test_unlink.py
示例3: testUnlinkModuleGlobally
def testUnlinkModuleGlobally(self):
test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep, True)
stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'link'], cwd=test_module)
self.assertEqual(statuscode, 0)
stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'unlink'], cwd=test_module)
self.assertEqual(statuscode, 0)
util.rmRf(test_module)
开发者ID:ARMmbed,项目名称:yotta,代码行数:7,代码来源:test_unlink.py
示例4: test_logoutLoggedOut
def test_logoutLoggedOut(self):
# test logging out when already logged out: should be a no-op
stdout, stderr, status = cli.run(['logout'])
self.assertEqual(status, 0)
# check that we're still logged out:
stdout, stderr, status = cli.run(['whoami'])
self.assertIn('not logged in', stdout+stderr)
开发者ID:ARMmbed,项目名称:yotta,代码行数:7,代码来源:test_account.py
示例5: testUpdateWithShrinkwrap
def testUpdateWithShrinkwrap(self):
test_dir = util.writeTestFiles(Test_Existing_Shrinkwrap, True)
stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'update'], cwd=test_dir)
self.assertEqual(statuscode, 0)
stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'list'], cwd=test_dir)
self.assertEqual(statuscode, 0)
# as opposed to 0.0.2 which is the latest
self.assertIn('test-testing-dummy 0.0.1', stdout+stderr)
util.rmRf(test_dir)
开发者ID:bearsh,项目名称:yotta,代码行数:11,代码来源:test_shrinkwrap.py
示例6: test_notOutdated
def test_notOutdated(self):
path = util.writeTestFiles(Test_Outdated, True)
stdout, stderr, statuscode = cli.run(['-t', 'x86-linux-native', 'up'], cwd=path)
self.assertEqual(statuscode, 0)
stdout, stderr, statuscode = cli.run(['-t', 'x86-linux-native', 'outdated'], cwd=path)
self.assertEqual(statuscode, 0)
self.assertNotIn('test-testing-dummy', stdout + stderr)
util.rmRf(path)
开发者ID:ARMmbed,项目名称:yotta,代码行数:11,代码来源:test_outdated.py
示例7: testTargetLinkedBuild
def testTargetLinkedBuild(self):
linked_in_target = util.writeTestFiles(util.getNativeTargetDescription(), True)
test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep_Preinstalled, True)
stdout, stderr, statuscode = cli.run(['-t', 'test-native-target', '--plain', 'link-target'], cwd=linked_in_target)
self.assertEqual(statuscode, 0)
stdout, stderr, statuscode = cli.run(['-t', 'test-native-target', '--plain', 'link-target', 'test-native-target'], cwd=test_module)
self.assertEqual(statuscode, 0)
stdout, stderr, statuscode = cli.run(['-t', 'test-native-target', '--plain', 'build'], cwd=test_module)
self.assertEqual(statuscode, 0)
util.rmRf(test_module)
util.rmRf(linked_in_target)
开发者ID:ARMmbed,项目名称:yotta,代码行数:13,代码来源:test_link.py
示例8: testLinkedBuild
def testLinkedBuild(self):
linked_in_module = util.writeTestFiles(util.Test_Trivial_Lib, True)
test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep, True)
stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'link'], cwd=linked_in_module)
self.assertEqual(statuscode, 0)
stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'link', 'test-trivial-lib'], cwd=test_module)
self.assertEqual(statuscode, 0)
stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'build'], cwd=test_module)
self.assertEqual(statuscode, 0)
util.rmRf(test_module)
util.rmRf(linked_in_module)
开发者ID:ARMmbed,项目名称:yotta,代码行数:13,代码来源:test_link.py
示例9: testUnlinkModule
def testUnlinkModule(self):
linked_in_module = util.writeTestFiles(util.Test_Trivial_Lib, True)
test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep, True)
stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'link'], cwd=linked_in_module)
self.assertEqual(statuscode, 0)
stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'link', 'test-trivial-lib'], cwd=test_module)
self.assertEqual(statuscode, 0)
self.assertTrue(os.path.exists(os.path.join(test_module, 'yotta_modules', 'test-trivial-lib')))
stdout, stderr, statuscode = cli.run(['-t', util.nativeTarget(), '--plain', 'unlink', 'test-trivial-lib'], cwd=test_module)
self.assertEqual(statuscode, 0)
self.assertTrue(not os.path.exists(os.path.join(test_module, 'yotta_modules', 'test-trivial-lib')))
util.rmRf(test_module)
util.rmRf(linked_in_module)
开发者ID:ARMmbed,项目名称:yotta,代码行数:15,代码来源:test_unlink.py
示例10: testUnlinkTarget
def testUnlinkTarget(self):
linked_in_target = util.writeTestFiles(util.getNativeTargetDescription(), True)
test_module = util.writeTestFiles(util.Test_Testing_Trivial_Lib_Dep_Preinstalled, True)
stdout, stderr, statuscode = cli.run(['-t', 'test-native-target', '--plain', 'link-target'], cwd=linked_in_target)
self.assertEqual(statuscode, 0)
stdout, stderr, statuscode = cli.run(['-t', 'test-native-target', '--plain', 'link-target', 'test-native-target'], cwd=test_module)
self.assertEqual(statuscode, 0)
self.assertTrue(os.path.exists(os.path.join(test_module, 'yotta_targets', 'test-native-target')))
stdout, stderr, statuscode = cli.run(['-t', 'test-native-target', '--plain', 'unlink-target', 'test-native-target'], cwd=test_module)
self.assertEqual(statuscode, 0)
self.assertTrue(not os.path.exists(os.path.join(test_module, 'yotta_targets', 'test-native-target')))
util.rmRf(test_module)
util.rmRf(linked_in_target)
开发者ID:ARMmbed,项目名称:yotta,代码行数:15,代码来源:test_unlink.py
示例11: testMissingDependenciesShrinkwrap
def testMissingDependenciesShrinkwrap(self):
test_dir = util.writeTestFiles(Test_Shrinkwrap_Missing_Dependency, True)
stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'shrinkwrap'], cwd=test_dir)
self.assertNotEqual(statuscode, 0)
self.assertFalse(os.path.exists(os.path.join(test_dir, 'yotta-shrinkwrap.json')))
self.assertIn('is missing', stdout+stderr)
util.rmRf(test_dir)
开发者ID:bearsh,项目名称:yotta,代码行数:7,代码来源:test_shrinkwrap.py
示例12: test_preVersionPreventsBump
def test_preVersionPreventsBump(self):
with open(os.path.join(self.test_dir, 'module.json'), 'w') as f:
f.write(Test_PreventVersion_JSON)
stdout, stderr, statuscode = cli.run(['version', '1.2.3'], cwd=self.test_dir)
self.assertNotEqual(statuscode, 0)
stdout = self.runCheckCommand(['version'])
self.assertNotIn('1.2.3', stdout)
开发者ID:ARMmbed,项目名称:yotta,代码行数:7,代码来源:test_version.py
示例13: test_binNonExistent
def test_binNonExistent(self):
test_dir = util.writeTestFiles(Test_Bin_Nonexistent)
stdout, stderr, statuscode = cli.run(['--target', util.nativeTarget(), 'build'], cwd=test_dir)
self.assertIn('directory "doesntexist" doesn\'t exist', stdout+stderr)
# !!! FIXME: should this error be fatal?
# self.assertNotEqual(statuscode, 0)
util.rmRf(test_dir)
开发者ID:ARMmbed,项目名称:yotta,代码行数:7,代码来源:test_build.py
示例14: test_prePublishPreventsPublish
def test_prePublishPreventsPublish(self):
path = util.writeTestFiles(Test_prePublish_Prevents_Publish, True)
stdout, stderr, statuscode = cli.run(['-t', 'x86-linux-native', '--noninteractive', 'publish'], cwd=path)
self.assertNotEqual(statuscode, 0)
self.assertIn('prePublish script error code 1 prevents publishing', stdout + stderr)
util.rmRf(path)
开发者ID:ARMmbed,项目名称:yotta,代码行数:8,代码来源:test_publish.py
示例15: runCheckCommand
def runCheckCommand(args, test_dir):
stdout, stderr, statuscode = cli.run(args, cwd=test_dir)
if statuscode != 0:
print('command failed with status %s' % statuscode)
print(stdout)
print(stderr)
assert(statuscode == 0)
return '%s %s' % (stdout, stderr)
开发者ID:ARMmbed,项目名称:yotta,代码行数:8,代码来源:util.py
示例16: testCreateShrinkwrap
def testCreateShrinkwrap(self):
test_dir = util.writeTestFiles(Test_Shrinkwrap, True)
stdout, stderr, statuscode = cli.run(['-t', Test_Target, '--plain', 'shrinkwrap'], cwd=test_dir)
self.assertEqual(statuscode, 0)
self.assertTrue(os.path.exists(os.path.join(test_dir, 'yotta-shrinkwrap.json')))
util.rmRf(test_dir)
开发者ID:bearsh,项目名称:yotta,代码行数:8,代码来源:test_shrinkwrap.py
示例17: test_updateExplicit
def test_updateExplicit(self):
path = util.writeTestFiles(Test_Outdated, True)
stdout, stderr, statuscode = cli.run(['-t', 'x86-linux-native', 'update', 'test-testing-dummy'], cwd=path)
self.assertEqual(statuscode, 0)
self.assertIn('download test-testing-dummy', stdout + stderr)
util.rmRf(path)
开发者ID:ARMmbed,项目名称:yotta,代码行数:8,代码来源:test_update.py
示例18: runCheckCommand
def runCheckCommand(self, args, test_dir):
stdout, stderr, statuscode = cli.run(args, cwd=self.test_dir)
if statuscode != 0:
print('command failed with status %s' % statuscode)
print(stdout)
print(stderr)
self.assertEqual(statuscode, 0)
return stdout or stderr
开发者ID:ARMmbed,项目名称:yotta,代码行数:8,代码来源:test_ignores.py
示例19: test_warnOfficialKeywords
def test_warnOfficialKeywords(self):
path = util.writeTestFiles(Test_Publish, True)
stdout, stderr, statuscode = cli.run(['-t', 'x86-linux-native', '--noninteractive', 'publish'], cwd=path)
self.assertNotEqual(statuscode, 0)
self.assertIn('Is this really an officially supported mbed module', stdout + stderr)
util.rmRf(path)
开发者ID:bearsh,项目名称:yotta,代码行数:8,代码来源:test_publish.py
示例20: test_testOutputFilterNotFound
def test_testOutputFilterNotFound(self):
test_dir = util.writeTestFiles(Test_Fitler_NotFound, True)
stdout, stderr, statuscode = cli.run(['--target', systemDefaultTarget(), 'test'], cwd=test_dir)
if statuscode == 0:
print(stdout)
print(stderr)
self.assertNotEqual(statuscode, 0)
util.rmRf(test_dir)
开发者ID:ARMmbed,项目名称:yotta,代码行数:8,代码来源:test_test.py
注:本文中的yotta.test.cli.cli.run函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论