• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python factory.PortFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中webkitpy.layout_tests.port.factory.PortFactory的典型用法代码示例。如果您正苦于以下问题:Python PortFactory类的具体用法?Python PortFactory怎么用?Python PortFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: test_basic

    def test_basic(self):
        cmd = [sys.executable, '-c', 'import sys; import time; time.sleep(0.02); print "stdout"; sys.stdout.flush(); print >>sys.stderr, "stderr"']
        host = SystemHost()
        factory = PortFactory(host)
        port = factory.get()
        now = time.time()
        proc = server_process.ServerProcess(port, 'python', cmd)
        proc.write('')

        self.assertEqual(proc.poll(), None)
        self.assertFalse(proc.has_crashed())

        # check that doing a read after an expired deadline returns
        # nothing immediately.
        line = proc.read_stdout_line(now - 1)
        self.assertEqual(line, None)

        # FIXME: This part appears to be flaky. line should always be non-None.
        # FIXME: https://bugs.webkit.org/show_bug.cgi?id=88280
        line = proc.read_stdout_line(now + 1.0)
        if line:
            self.assertEqual(line.strip(), "stdout")

        line = proc.read_stderr_line(now + 1.0)
        if line:
            self.assertEqual(line.strip(), "stderr")

        proc.stop(0)
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:28,代码来源:server_process_unittest.py


示例2: test_path_to_expectations

 def test_path_to_expectations(self):
     port_factory = PortFactory(MockSystemHost())
     for port_name in ("google-chrome-linux32", "google-chrome-linux64", "google-chrome-mac", "google-chrome-win"):
         self.assertTrue(
             port_factory.get(port_name)
             .path_to_test_expectations_file()
             .endswith("platform/chromium/TestExpectations")
         )
开发者ID:yang-bo,项目名称:webkit,代码行数:8,代码来源:google_chrome_unittest.py


示例3: __init__

 def __init__(self, host, **kwargs):
     prefix = "mock-"
     if "port_name" in kwargs:
         kwargs["port_name"] = kwargs["port_name"][len(prefix) :]
     self._host = host
     self.__delegate = PortFactory(host).get(**kwargs)
     self.__real_name = prefix + self.__delegate.name()
开发者ID:,项目名称:,代码行数:7,代码来源:


示例4: _verify_expectations_overrides

    def _verify_expectations_overrides(self, port_name):
        host = MockSystemHost()
        chromium_port = PortFactory(host).get("chromium-mac-leopard")
        chromium_base = chromium_port.path_from_chromium_base()
        port = PortFactory(host).get(port_name=port_name, options=None)

        expected_chromium_overrides = '// chromium overrides\n'
        expected_chrome_overrides = '// chrome overrides\n'
        chromium_path = host.filesystem.join(chromium_base, 'webkit', 'tools', 'layout_tests', 'test_expectations.txt')
        chrome_path = host.filesystem.join(chromium_base, 'webkit', 'tools', 'layout_tests', 'test_expectations_chrome.txt')

        host.filesystem.files[chromium_path] = expected_chromium_overrides
        host.filesystem.files[chrome_path] = None
        actual_chrome_overrides = port.test_expectations_overrides()
        self.assertEqual(expected_chromium_overrides, actual_chrome_overrides)

        host.filesystem.files[chrome_path] = expected_chrome_overrides
        actual_chrome_overrides = port.test_expectations_overrides()
        self.assertEqual(actual_chrome_overrides, expected_chromium_overrides + expected_chrome_overrides)
开发者ID:dzhshf,项目名称:WebKit,代码行数:19,代码来源:google_chrome_unittest.py


示例5: Host

class Host(SystemHost):
    def __init__(self):
        SystemHost.__init__(self)
        self.web = web.Web()

        # FIXME: Checkout should own the scm object.
        self._scm = None
        self._checkout = None

        # Everything below this line is WebKit-specific and belongs on a higher-level object.
        self.bugs = bugzilla.Bugzilla()
        self.buildbot = buildbot.BuildBot()

        # FIXME: Unfortunately Port objects are currently the central-dispatch objects of the NRWT world.
        # In order to instantiate a port correctly, we have to pass it at least an executive, user, scm, and filesystem
        # so for now we just pass along the whole Host object.
        # FIXME: PortFactory doesn't belong on this Host object if Port is going to have a Host (circular dependency).
        self.port_factory = PortFactory(self)

        self._engage_awesome_locale_hacks()

    # We call this from the Host constructor, as it's one of the
    # earliest calls made for all webkitpy-based programs.
    def _engage_awesome_locale_hacks(self):
        # To make life easier on our non-english users, we override
        # the locale environment variables inside webkitpy.
        # If we don't do this, programs like SVN will output localized
        # messages and svn.py will fail to parse them.
        # FIXME: We should do these overrides *only* for the subprocesses we know need them!
        # This hack only works in unix environments.
        os.environ['LANGUAGE'] = 'en'
        os.environ['LANG'] = 'en_US.UTF-8'
        os.environ['LC_MESSAGES'] = 'en_US.UTF-8'
        os.environ['LC_ALL'] = ''

    def initialize_scm(self, patch_directories=None):
        detector = SCMDetector(self.filesystem, self.executive)
        self._scm = detector.default_scm(patch_directories)
        self._checkout = Checkout(self.scm())

    def scm(self):
        return self._scm

    def checkout(self):
        return self._checkout

    def buildbot_for_builder_name(self, name):
        if self.port_factory.get_from_builder_name(name).is_chromium():
            return self.chromium_buildbot()
        return self.buildbot

    @memoized
    def watch_list(self):
        return WatchListLoader(self.filesystem).load()
开发者ID:,项目名称:,代码行数:54,代码来源:


示例6: __init__

    def __init__(self, options, args, host, stdin, stdout, stderr):
        self._options = options
        self._args = args
        self._host = host
        self._stdout = stdout
        self._stdin = stdin
        self._stderr = stderr

        port_name = None
        if options.platform:
            port_name = options.platform
        self._port = PortFactory(host).get(port_name=port_name, options=options)
        self._driver = self._port.create_driver(0)
开发者ID:awong-chromium,项目名称:webkit,代码行数:13,代码来源:mock_drt.py


示例7: assert_port_works

    def assert_port_works(self, port_name, input_name=None, platform=None):
        host = MockSystemHost()
        host.filesystem = FileSystem()  # FIXME: This test should not use a real filesystem!

        # test that we got the right port
        mock_options = MockOptions(accelerated_2d_canvas=None,
                                   accelerated_video=None,
                                   builder_name='foo',
                                   child_processes=None)
        if input_name and platform:
            port = PortFactory(host).get(host, platform=platform, port_name=input_name, options=mock_options)
        else:
            port = PortFactory(host).get(host, port_name=port_name, options=mock_options)
        self.assertTrue(port._options.accelerated_2d_canvas)
        self.assertTrue(port._options.accelerated_video)
        self.assertTrue(port._options.experimental_fully_parallel)
        self.assertEqual(port._options.builder_name, 'foo - GPU')

        self.assertTrue(port.name().startswith(port_name))

        # test that it has the right directories in front of the search path.
        paths = port.baseline_search_path()
        self.assertEqual(port._webkit_baseline_path(port_name), paths[0])
        if port_name == 'chromium-gpu-linux':
            self.assertEqual(port._webkit_baseline_path('chromium-gpu-win'), paths[1])
            self.assertEqual(port._webkit_baseline_path('chromium-gpu'), paths[2])
        else:
            self.assertEqual(port._webkit_baseline_path('chromium-gpu'), paths[1])

        # Test that we're limiting to the correct directories.
        # These two tests are picked mostly at random, but we make sure they
        # exist separately from being filtered out by the port.

        # Note that this is using a real filesystem.
        files = port.tests(None)

        path = 'fast/html/keygen.html'
        self.assertTrue(port._filesystem.exists(port.abspath_for_test(path)))
        self.assertFalse(path in files)
开发者ID:,项目名称:,代码行数:39,代码来源:


示例8: test_basic

    def test_basic(self):
        cmd = [sys.executable, '-c', 'import sys; import time; time.sleep(0.02); print "stdout"; sys.stdout.flush(); print >>sys.stderr, "stderr"']
        host = SystemHost()
        factory = PortFactory(host)
        port = factory.get()
        now = time.time()
        proc = server_process.ServerProcess(port, 'python', cmd)
        proc.write('')

        self.assertEquals(proc.poll(), None)
        self.assertFalse(proc.has_crashed())

        # check that doing a read after an expired deadline returns
        # nothing immediately.
        line = proc.read_stdout_line(now - 1)
        self.assertEquals(line, None)

        line = proc.read_stdout_line(now + 1.0)
        self.assertEquals(line.strip(), "stdout")

        line = proc.read_stderr_line(now + 1.0)
        self.assertEquals(line.strip(), "stderr")

        proc.stop()
开发者ID:eth-srl,项目名称:R4,代码行数:24,代码来源:server_process_unittest.py


示例9: MockDRT

class MockDRT(object):
    def __init__(self, options, args, host, stdin, stdout, stderr):
        self._options = options
        self._args = args
        self._host = host
        self._stdout = stdout
        self._stdin = stdin
        self._stderr = stderr

        port_name = None
        if options.platform:
            port_name = options.platform
        self._port = PortFactory(host).get(port_name=port_name, options=options)
        self._driver = self._port.create_driver(0)

    def run(self):
        while True:
            line = self._stdin.readline()
            if not line:
                break
            self.run_one_test(self.parse_input(line))
        return 0

    def parse_input(self, line):
        return _DRTInput(line)

    def run_one_test(self, test_input):
        port = self._port
        if test_input.uri.startswith("http://") or test_input.uri.startswith("https://"):
            test_name = self._driver.uri_to_test(test_input.uri)
        else:
            test_name = port.relative_test_filename(test_input.uri)

        actual_text = port.expected_text(test_name)
        actual_audio = port.expected_audio(test_name)
        if self._options.pixel_tests and test_input.checksum:
            actual_checksum = port.expected_checksum(test_name)
            actual_image = port.expected_image(test_name)

        if actual_audio:
            self._stdout.write("Content-Type: audio/wav\n")
            self._stdout.write("Content-Transfer-Encoding: base64\n")
            output = base64.b64encode(actual_audio)
            self._stdout.write(output)
        else:
            self._stdout.write("Content-Type: text/plain\n")
            # FIXME: Note that we don't ensure there is a trailing newline!
            # This mirrors actual (Mac) DRT behavior but is a bug.
            self._stdout.write(actual_text)

        self._stdout.write("#EOF\n")

        if self._options.pixel_tests and test_input.checksum:
            self._stdout.write("\n")
            self._stdout.write("ActualHash: %s\n" % actual_checksum)
            self._stdout.write("ExpectedHash: %s\n" % test_input.checksum)
            if actual_checksum != test_input.checksum:
                self._stdout.write("Content-Type: image/png\n")
                self._stdout.write("Content-Length: %s\n" % len(actual_image))
                self._stdout.write(actual_image)
        self._stdout.write("#EOF\n")
        self._stdout.flush()
        self._stderr.flush()
开发者ID:,项目名称:,代码行数:63,代码来源:


示例10: _assert_baseline_path

 def _assert_baseline_path(self, port_name, baseline_path):
     port = PortFactory(MockSystemHost()).get(port_name)
     self.assertEquals(port.name(), port_name)
     self.assertEquals(port.baseline_path(), port._webkit_baseline_path(baseline_path))
开发者ID:,项目名称:,代码行数:4,代码来源:


示例11: _verify_expectations_overrides

 def _verify_expectations_overrides(self, port_name):
     host = MockSystemHost()
     port = PortFactory(host).get(port_name=port_name, options=None)
     self.assertTrue('TestExpectations' in port.expectations_files()[0])
     self.assertTrue('skia_test_expectations.txt' in port.expectations_files()[1])
     self.assertTrue('test_expectations_chrome.txt' in port.expectations_files()[-1])
开发者ID:,项目名称:,代码行数:6,代码来源:


示例12: MockDRT

class MockDRT(object):
    def __init__(self, options, args, host, stdin, stdout, stderr):
        self._options = options
        self._args = args
        self._host = host
        self._stdout = stdout
        self._stdin = stdin
        self._stderr = stderr

        port_name = None
        if options.platform:
            port_name = options.platform
        self._port = PortFactory(host).get(port_name=port_name, options=options)
        self._driver = self._port.create_driver(0)

    def run(self):
        while True:
            line = self._stdin.readline()
            if not line:
                return 0
            driver_input = self.input_from_line(line)
            dirname, basename = self._port.split_test(driver_input.test_name)
            is_reftest = (self._port.reference_files(driver_input.test_name) or
                          self._port.is_reference_html_file(self._port._filesystem, dirname, basename))
            output = self.output_for_test(driver_input, is_reftest)
            self.write_test_output(driver_input, output, is_reftest)

    def input_from_line(self, line):
        vals = line.strip().split("'")
        if len(vals) == 1:
            uri = vals[0]
            checksum = None
        else:
            uri = vals[0]
            checksum = vals[1]
        if uri.startswith('http://') or uri.startswith('https://'):
            test_name = self._driver.uri_to_test(uri)
        else:
            test_name = self._port.relative_test_filename(uri)

        return DriverInput(test_name, 0, checksum, self._options.pixel_tests)

    def output_for_test(self, test_input, is_reftest):
        port = self._port
        actual_text = port.expected_text(test_input.test_name)
        actual_audio = port.expected_audio(test_input.test_name)
        actual_image = None
        actual_checksum = None
        if is_reftest:
            # Make up some output for reftests.
            actual_text = 'reference text\n'
            actual_checksum = 'mock-checksum'
            actual_image = 'blank'
            if test_input.test_name.endswith('-mismatch.html'):
                actual_text = 'not reference text\n'
                actual_checksum = 'not-mock-checksum'
                actual_image = 'not blank'
        elif self._options.pixel_tests and test_input.image_hash:
            actual_checksum = port.expected_checksum(test_input.test_name)
            actual_image = port.expected_image(test_input.test_name)

        return DriverOutput(actual_text, actual_image, actual_checksum, actual_audio)

    def write_test_output(self, test_input, output, is_reftest):
        if output.audio:
            self._stdout.write('Content-Type: audio/wav\n')
            self._stdout.write('Content-Transfer-Encoding: base64\n')
            self._stdout.write(base64.b64encode(output.audio))
        else:
            self._stdout.write('Content-Type: text/plain\n')
            # FIXME: Note that we don't ensure there is a trailing newline!
            # This mirrors actual (Mac) DRT behavior but is a bug.
            if output.text:
                self._stdout.write(output.text)

        self._stdout.write('#EOF\n')

        if self._options.pixel_tests and output.image_hash:
            self._stdout.write('\n')
            self._stdout.write('ActualHash: %s\n' % output.image_hash)
            self._stdout.write('ExpectedHash: %s\n' % test_input.image_hash)
            if output.image_hash != test_input.image_hash:
                self._stdout.write('Content-Type: image/png\n')
                self._stdout.write('Content-Length: %s\n' % len(output.image))
                self._stdout.write(output.image)
        self._stdout.write('#EOF\n')
        self._stdout.flush()
        self._stderr.write('#EOF\n')
        self._stderr.flush()
开发者ID:awong-chromium,项目名称:webkit,代码行数:89,代码来源:mock_drt.py


示例13: __init__

 def __init__(self, host, port_name, **kwargs):
     self.__delegate = PortFactory(host).get(port_name.replace('mock-', ''), **kwargs)
     self.__delegate_driver_class = self.__delegate._driver_class
     self.__delegate._driver_class = types.MethodType(self._driver_class, self.__delegate)
开发者ID:Igalia,项目名称:blink,代码行数:4,代码来源:mock_drt.py


示例14: MockDRTPort

class MockDRTPort(object):
    port_name = 'mock'

    @classmethod
    def determine_full_port_name(cls, host, options, port_name):
        return port_name

    def __init__(self, host, port_name, **kwargs):
        self.__delegate = PortFactory(host).get(port_name.replace('mock-', ''), **kwargs)
        self.__delegate_driver_class = self.__delegate._driver_class
        self.__delegate._driver_class = types.MethodType(self._driver_class, self.__delegate)

    def __getattr__(self, name):
        return getattr(self.__delegate, name)

    def check_build(self, needs_http, printer):
        return True

    def check_sys_deps(self, needs_http):
        return True

    def _driver_class(self, delegate):
        return self._mocked_driver_maker

    def _mocked_driver_maker(self, port, worker_number, pixel_tests, no_timeout=False):
        path_to_this_file = self.host.filesystem.abspath(__file__.replace('.pyc', '.py'))
        driver = self.__delegate_driver_class()(self, worker_number, pixel_tests, no_timeout)
        driver.cmd_line = self._overriding_cmd_line(driver.cmd_line,
                                                    self.__delegate._path_to_driver(),
                                                    sys.executable,
                                                    path_to_this_file,
                                                    self.__delegate.name())
        return driver

    @staticmethod
    def _overriding_cmd_line(original_cmd_line, driver_path, python_exe, this_file, port_name):
        def new_cmd_line(pixel_tests, per_test_args):
            cmd_line = original_cmd_line(pixel_tests, per_test_args)
            index = cmd_line.index(driver_path)
            cmd_line[index:index + 1] = [python_exe, this_file, '--platform', port_name]
            return cmd_line

        return new_cmd_line

    def start_helper(self):
        pass

    def start_http_server(self, number_of_servers):
        pass

    def start_websocket_server(self):
        pass

    def acquire_http_lock(self):
        pass

    def stop_helper(self):
        pass

    def stop_http_server(self):
        pass

    def stop_websocket_server(self):
        pass

    def release_http_lock(self):
        pass

    def _make_wdiff_available(self):
        self.__delegate._wdiff_available = True

    def setup_environ_for_server(self, server_name):
        env = self.__delegate.setup_environ_for_server()
        # We need to propagate PATH down so the python code can find the checkout.
        env['PATH'] = os.environ['PATH']
        return env

    def lookup_virtual_test_args(self, test_name):
        suite = self.__delegate.lookup_virtual_suite(test_name)
        return suite.args + ['--virtual-test-suite-name', suite.name, '--virtual-test-suite-base', suite.base]
开发者ID:Igalia,项目名称:blink,代码行数:80,代码来源:mock_drt.py


示例15: MockDRT

class MockDRT(object):
    def __init__(self, options, args, host, stdin, stdout, stderr):
        self._options = options
        self._args = args
        self._host = host
        self._stdout = stdout
        self._stdin = stdin
        self._stderr = stderr

        port_name = None
        if options.platform:
            port_name = options.platform
        self._port = PortFactory(host).get(port_name=port_name, options=options)
        self._driver = self._port.create_driver(0)

    def run(self):
        while True:
            line = self._stdin.readline()
            if not line:
                return 0
            driver_input = self.input_from_line(line)
            dirname, basename = self._port.split_test(driver_input.test_name)
            is_reftest = (self._port.reference_files(driver_input.test_name) or
                          self._port.is_reference_html_file(self._port._filesystem, dirname, basename))
            output = self.output_for_test(driver_input, is_reftest)
            self.write_test_output(driver_input, output, is_reftest)

    def input_from_line(self, line):
        vals = line.strip().split("'")
        uri = vals[0]
        checksum = None
        should_run_pixel_tests = False
        if len(vals) == 2 and vals[1] == '--pixel-test':
            should_run_pixel_tests = True
        elif len(vals) == 3 and vals[1] == '--pixel-test':
            should_run_pixel_tests = True
            checksum = vals[2]
        elif len(vals) != 1:
            raise NotImplementedError

        if uri.startswith('http://') or uri.startswith('https://'):
            test_name = self._driver.uri_to_test(uri)
        else:
            test_name = self._port.relative_test_filename(uri)

        return DriverInput(test_name, 0, checksum, should_run_pixel_tests)

    def output_for_test(self, test_input, is_reftest):
        port = self._port
        if self._options.virtual_test_suite_name:
            test_input.test_name = test_input.test_name.replace(self._options.virtual_test_suite_base, self._options.virtual_test_suite_name)
        actual_text = port.expected_text(test_input.test_name)
        actual_audio = port.expected_audio(test_input.test_name)
        actual_image = None
        actual_checksum = None
        if is_reftest:
            # Make up some output for reftests.
            actual_text = 'reference text\n'
            actual_checksum = 'mock-checksum'
            actual_image = 'blank'
            if test_input.test_name.endswith('-mismatch.html'):
                actual_text = 'not reference text\n'
                actual_checksum = 'not-mock-checksum'
                actual_image = 'not blank'
        elif test_input.should_run_pixel_test and test_input.image_hash:
            actual_checksum = port.expected_checksum(test_input.test_name)
            actual_image = port.expected_image(test_input.test_name)

        if self._options.actual_directory:
            actual_path = port._filesystem.join(self._options.actual_directory, test_input.test_name)
            root, _ = port._filesystem.splitext(actual_path)
            text_path = root + '-actual.txt'
            if port._filesystem.exists(text_path):
                actual_text = port._filesystem.read_binary_file(text_path)
            audio_path = root + '-actual.wav'
            if port._filesystem.exists(audio_path):
                actual_audio = port._filesystem.read_binary_file(audio_path)
            image_path = root + '-actual.png'
            if port._filesystem.exists(image_path):
                actual_image = port._filesystem.read_binary_file(image_path)
                with port._filesystem.open_binary_file_for_reading(image_path) as filehandle:
                    actual_checksum = read_checksum_from_png.read_checksum(filehandle)

        return DriverOutput(actual_text, actual_image, actual_checksum, actual_audio)

    def write_test_output(self, test_input, output, is_reftest):
        if output.audio:
            self._stdout.write('Content-Type: audio/wav\n')
            self._stdout.write('Content-Transfer-Encoding: base64\n')
            self._stdout.write(base64.b64encode(output.audio))
            self._stdout.write('\n')
        else:
            self._stdout.write('Content-Type: text/plain\n')
            # FIXME: Note that we don't ensure there is a trailing newline!
            # This mirrors actual (Mac) DRT behavior but is a bug.
            if output.text:
                self._stdout.write(output.text)

        self._stdout.write('#EOF\n')

#.........这里部分代码省略.........
开发者ID:Igalia,项目名称:blink,代码行数:101,代码来源:mock_drt.py


示例16: Rebaseliner

class Rebaseliner(object):
    """Class to produce new baselines for a given platform."""

    REVISION_REGEX = r"<a href=\"(\d+)/\">"

    def __init__(
        self, running_port, target_port, platform, options, url_fetcher, zip_factory, scm, logged_before=False
    ):
        """
        Args:
            running_port: the Port the script is running on.
            target_port: the Port the script uses to find port-specific
                configuration information like the test_expectations.txt
                file location and the list of test platforms.
            platform: the test platform to rebaseline
            options: the command-line options object.
            url_fetcher: object that can fetch objects from URLs
            zip_factory: optional object that can fetch zip files from URLs
            scm: scm object for adding new baselines
            logged_before: whether the previous running port logged anything.
        """
        self._platform = platform
        self._options = options
        self._port = running_port
        self._filesystem = running_port._filesystem
        self._target_port = target_port

        # FIXME: This should get its PortFactory from a Host object.
        # Note: using running_port.executive, running_port.user since we can't get them from a host.
        self._rebaseline_port = PortFactory().get(
            platform, options, filesystem=self._filesystem, executive=running_port.executive, user=running_port.user
        )
        self._rebaselining_tests = set()
        self._rebaselined_tests = []
        self._logged_before = logged_before
        self.did_log = False

        # Create tests and expectations helper which is used to:
        #   -. compile list of tests that need rebaselining.
        #   -. update the tests in test_expectations file after rebaseline
        #      is done.
        expectations_str = self._rebaseline_port.test_expectations()
        self._test_expectations = test_expectations.TestExpectations(
            self._rebaseline_port, None, expectations_str, self._rebaseline_port.test_configuration(), False
        )
        self._url_fetcher = url_fetcher
        self._zip_factory = zip_factory
        self._scm = scm

    def run(self):
        """Run rebaseline process."""

        log_dashed_string("Compiling rebaselining tests", self._platform, logging.DEBUG)
        if not self._compile_rebaselining_tests():
            return False
        if not self._rebaselining_tests:
            return True

        self.did_log = True
        log_dashed_string("Downloading archive", self._platform, logging.DEBUG)
        archive_file = self._download_buildbot_archive()
        _log.debug("")
        if not archive_file:
            _log.error("No archive found.")
            return False

        log_dashed_string("Extracting and adding new baselines", self._platform, logging.DEBUG)
        self._extract_and_add_new_baselines(archive_file)
        archive_file.close()

        log_dashed_string("Updating rebaselined tests in file", self._platform)

        if len(self._rebaselining_tests) != len(self._rebaselined_tests):
            _log.debug("")
            _log.debug("NOT ALL TESTS WERE REBASELINED.")
            _log.debug("  Number marked for rebaselining: %d", len(self._rebaselining_tests))
            _log.debug("  Number actually rebaselined: %d", len(self._rebaselined_tests))
            _log.info("")
            return False

        _log.debug("  All tests needing rebaselining were successfully rebaselined.")
        _log.info("")
        return True

    def remove_rebaselining_expectations(self, tests, backup):
        """if backup is True, we backup the original test expectations file."""
        new_expectations = self._test_expectations.remove_rebaselined_tests(tests)
        path = self._target_port.path_to_test_expectations_file()
        if backup:
            date_suffix = time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))
            backup_file = "%s.orig.%s" % (path, date_suffix)
            if self._filesystem.exists(backup_file):
                self._filesystem.remove(backup_file)
            _log.debug('Saving original file to "%s"', backup_file)
            self._filesystem.move(path, backup_file)

        self._filesystem.write_text_file(path, new_expectations)
        # self._scm.add(path)

    def get_rebaselined_tests(self):
#.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


示例17: _verify_baseline_path

 def _verify_baseline_path(self, expected_path, port_name):
     port = PortFactory(MockSystemHost()).get(port_name=port_name)
     path = port.baseline_search_path()[0]
     self.assertEqual(expected_path, port._filesystem.basename(path))
开发者ID:Moondee,项目名称:Artemis,代码行数:4,代码来源:google_chrome_unittest.py


示例18: MockDRTPort

class MockDRTPort(object):
    """MockPort implementation of the Port interface."""

    def __init__(self, host, **kwargs):
        prefix = "mock-"
        if "port_name" in kwargs:
            kwargs["port_name"] = kwargs["port_name"][len(prefix) :]
        self._host = host
        self.__delegate = PortFactory(host).get(**kwargs)
        self.__real_name = prefix + self.__delegate.name()

    def real_name(self):
        return self.__real_name

    def __getattr__(self, name):
        return getattr(self.__delegate, name)

    def check_build(self, needs_http):
        return True

    def check_sys_deps(self, needs_http):
        return True

    def driver_cmd_line(self):
        driver = self.create_driver(0)
        return driver.cmd_line()

    def _path_to_driver(self):
        return self._host.filesystem.abspath(__file__)

    def create_driver(self, worker_number):
        # We need to create a driver object as the delegate would, but
        # overwrite the path to the driver binary in its command line. We do
        # this by actually overwriting its cmd_line() method with a proxy
        # method that splices in the mock_drt path and command line arguments
        # in place of the actual path to the driver binary.

        def overriding_cmd_line():
            cmd = self.__original_driver_cmd_line()
            index = cmd.index(self.__delegate._path_to_driver())
            # FIXME: Why does this need to use sys.executable (instead of something mockable)?
            cmd[index : index + 1] = [sys.executable, self._path_to_driver(), "--platform", self.name()]
            return cmd

        delegated_driver = self.__delegate.create_driver(worker_number)
        self.__original_driver_cmd_line = delegated_driver.cmd_line
        delegated_driver.cmd_line = overriding_cmd_line
        return delegated_driver

    def start_helper(self):
        pass

    def start_http_server(self):
        pass

    def start_websocket_server(self):
        pass

    def acquire_http_lock(self):
        pass

    def stop_helper(self):
        pass

    def stop_http_server(self):
        pass

    def stop_websocket_server(self):
        pass

    def release_http_lock(self):
        pass
开发者ID:,项目名称:,代码行数:72,代码来源:


示例19: test_graphics_type

 def test_graphics_type(self):
     port = PortFactory(MockSystemHost()).get('chromium-gpu-mac')
     self.assertEquals('gpu', port.graphics_type())
开发者ID:,项目名称:,代码行数:3,代码来源:


示例20: _verify_baseline_search_path_startswith

 def _verify_baseline_search_path_startswith(self, port_name, expected_platform_dirs):
     port = PortFactory(MockSystemHost()).get(port_name=port_name)
     actual_platform_dirs = [port._filesystem.basename(path) for path in port.baseline_search_path()]
     self.assertEqual(expected_platform_dirs, actual_platform_dirs[0:len(expected_platform_dirs)])
开发者ID:dzhshf,项目名称:WebKit,代码行数:4,代码来源:google_chrome_unittest.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python test.add_unit_tests_to_mock_filesystem函数代码示例发布时间:2022-05-26
下一篇:
Python port.Port类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap