当前位置: 首页>>代码示例>>Python>>正文


Python Executive.popen方法代码示例

本文整理汇总了Python中webkitpy.common.system.executive.Executive.popen方法的典型用法代码示例。如果您正苦于以下问题:Python Executive.popen方法的具体用法?Python Executive.popen怎么用?Python Executive.popen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在webkitpy.common.system.executive.Executive的用法示例。


在下文中一共展示了Executive.popen方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_coverage_works

# 需要导入模块: from webkitpy.common.system.executive import Executive [as 别名]
# 或者: from webkitpy.common.system.executive.Executive import popen [as 别名]
    def test_coverage_works(self):
        # This is awkward; by design, running test-webkitpy -c will
        # create a .coverage file in tools, so we need to be
        # careful not to clobber an existing one, and to clean up.
        # FIXME: This design needs to change since it means we can't actually
        # run this method itself under coverage properly.
        filesystem = FileSystem()
        executive = Executive()
        module_path = filesystem.path_to_module(self.__module__)
        script_dir = module_path[0:module_path.find('webkitpy') - 1]
        coverage_file = filesystem.join(script_dir, '.coverage')
        coverage_file_orig = None
        if filesystem.exists(coverage_file):
            coverage_file_orig = coverage_file + '.orig'
            filesystem.move(coverage_file, coverage_file_orig)

        try:
            proc = executive.popen([sys.executable, filesystem.join(script_dir, 'test-webkitpy'), '-c', STUBS_CLASS + '.test_empty'],
                                stdout=executive.PIPE, stderr=executive.PIPE)
            out, _ = proc.communicate()
            retcode = proc.returncode
            self.assertEqual(retcode, 0)
            self.assertIn('Cover', out)
        finally:
            if coverage_file_orig:
                filesystem.move(coverage_file_orig, coverage_file)
            elif filesystem.exists(coverage_file):
                filesystem.remove(coverage_file)
开发者ID:Jamesducque,项目名称:mojo,代码行数:30,代码来源:main_unittest.py

示例2: integration_test_coverage_works

# 需要导入模块: from webkitpy.common.system.executive import Executive [as 别名]
# 或者: from webkitpy.common.system.executive.Executive import popen [as 别名]
 def integration_test_coverage_works(self):
     filesystem = FileSystem()
     executive = Executive()
     module_path = filesystem.path_to_module(self.__module__)
     script_dir = module_path[0:module_path.find('webkitpy') - 1]
     proc = executive.popen([sys.executable, filesystem.join(script_dir, 'test-webkitpy'), '-c', STUBS_CLASS + '.test_empty'],
                            stdout=executive.PIPE, stderr=executive.PIPE)
     out, _ = proc.communicate()
     retcode = proc.returncode
     self.assertEqual(retcode, 0)
     self.assertIn('Cover', out)
开发者ID:Igalia,项目名称:blink,代码行数:13,代码来源:main_unittest.py

示例3: test_popen_args

# 需要导入模块: from webkitpy.common.system.executive import Executive [as 别名]
# 或者: from webkitpy.common.system.executive.Executive import popen [as 别名]
 def test_popen_args(self):
     executive = Executive()
     # Explicitly naming the 'args' argument should not thow an exception.
     executive.popen(args=command_line('echo', 1), stdout=executive.PIPE).wait()
开发者ID:cheekiatng,项目名称:webkit,代码行数:6,代码来源:executive_unittest.py

示例4: test_auto_stringify_args

# 需要导入模块: from webkitpy.common.system.executive import Executive [as 别名]
# 或者: from webkitpy.common.system.executive.Executive import popen [as 别名]
 def test_auto_stringify_args(self):
     executive = Executive()
     executive.run_command(command_line('echo', 1))
     executive.popen(command_line('echo', 1), stdout=executive.PIPE).wait()
     self.assertEqual('echo 1', executive.command_for_printing(['echo', 1]))
开发者ID:cheekiatng,项目名称:webkit,代码行数:7,代码来源:executive_unittest.py

示例5: Bisector

# 需要导入模块: from webkitpy.common.system.executive import Executive [as 别名]
# 或者: from webkitpy.common.system.executive.Executive import popen [as 别名]
class Bisector(object):

    def __init__(self, tests, is_debug):
        self.executive = Executive()
        self.tests = tests
        self.expected_failure = tests[-1]
        self.is_debug = is_debug
        self.webkit_finder = WebKitFinder(FileSystem())

    def bisect(self):
        if self.test_fails_in_isolation():
            self.buckets = [Bucket([self.expected_failure])]
            print '%s fails when run in isolation.' % self.expected_failure
            self.print_result()
            return 0
        if not self.test_fails(self.tests):
            _log.error('%s does not fail' % self.expected_failure)
            return 1
        # Split the list of test into buckets. Each bucket has at least one test required to cause
        # the expected failure at the end. Split buckets in half until there are only buckets left
        # with one item in them.
        self.buckets = [Bucket(self.tests[:-1]), Bucket([self.expected_failure])]
        while not self.is_done():
            self.print_progress()
            self.split_largest_bucket()
        self.print_result()
        self.verify_non_flaky()
        return 0

    def test_fails_in_isolation(self):
        return self.test_bucket_list_fails([Bucket([self.expected_failure])])

    def verify_non_flaky(self):
        print 'Verifying the failure is not flaky by running 10 times.'
        count_failures = 0
        for i in range(0, 10):
            if self.test_bucket_list_fails(self.buckets):
                count_failures += 1
        print 'Failed %d/10 times' % count_failures

    def print_progress(self):
        count = 0
        for bucket in self.buckets:
            count += len(bucket.tests)
        print '%d tests left, %d buckets' % (count, len(self.buckets))

    def print_result(self):
        tests = []
        for bucket in self.buckets:
            tests += bucket.tests
        extra_args = ' --debug' if self.is_debug else ''
        print 'run-webkit-tests%s --child-processes=1 --order=none %s' % (extra_args, " ".join(tests))

    def is_done(self):
        for bucket in self.buckets:
            if bucket.size() > 1:
                return False
        return True

    def split_largest_bucket(self):
        index = 0
        largest_index = 0
        largest_size = 0
        for bucket in self.buckets:
            if bucket.size() > largest_size:
                largest_index = index
                largest_size = bucket.size()
            index += 1

        bucket_to_split = self.buckets[largest_index]
        halfway_point = int(largest_size / 2)
        first_half = Bucket(bucket_to_split.tests[:halfway_point])
        second_half = Bucket(bucket_to_split.tests[halfway_point:])

        buckets_before = self.buckets[:largest_index]
        buckets_after = self.buckets[largest_index + 1:]

        # Do the second half first because it tends to be faster because the http tests are front-loaded and slow.
        new_buckets = buckets_before + [second_half] + buckets_after
        if self.test_bucket_list_fails(new_buckets):
            self.buckets = new_buckets
            return

        new_buckets = buckets_before + [first_half] + buckets_after
        if self.test_bucket_list_fails(new_buckets):
            self.buckets = new_buckets
            return

        self.buckets = buckets_before + [first_half, second_half] + buckets_after

    def test_bucket_list_fails(self, buckets):
        tests = []
        for bucket in buckets:
            tests += bucket.tests
        return self.test_fails(tests)

    def test_fails(self, tests):
        extra_args = ['--debug'] if self.is_debug else []
        path_to_run_webkit_tests = self.webkit_finder.path_from_webkit_base('tools', 'test_sky')
        output = self.executive.popen([path_to_run_webkit_tests, '--child-processes', '1', '--order', 'none', '--no-retry', '--no-show-results', '--verbose'] + extra_args + tests, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
#.........这里部分代码省略.........
开发者ID:Jamesducque,项目名称:mojo,代码行数:103,代码来源:bisect_test_ordering.py

示例6: test_auto_stringify_args

# 需要导入模块: from webkitpy.common.system.executive import Executive [as 别名]
# 或者: from webkitpy.common.system.executive.Executive import popen [as 别名]
 def test_auto_stringify_args(self):
     executive = Executive()
     executive.run_command(command_line('echo', 1))
     executive.popen(command_line('echo', 1)).wait()
开发者ID:EQ4,项目名称:h5vcc,代码行数:6,代码来源:executive_unittest.py


注:本文中的webkitpy.common.system.executive.Executive.popen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。