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

Python path.abspath_to_uri函数代码示例

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

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



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

示例1: uri_to_test_name

    def uri_to_test_name(self, uri):
        """Return the base layout test name for a given URI.

        This returns the test name for a given URI, e.g., if you passed in
        "file:///src/LayoutTests/fast/html/keygen.html" it would return
        "fast/html/keygen.html".

        """
        test = uri
        if uri.startswith("file:///"):
            prefix = path.abspath_to_uri(self.layout_tests_dir()) + "/"
            return test[len(prefix):]

        if uri.startswith("http://127.0.0.1:8880/"):
            # websocket tests
            return test.replace('http://127.0.0.1:8880/', '')

        if uri.startswith("http://"):
            # regular HTTP test
            return test.replace('http://127.0.0.1:8000/', 'http/tests/')

        if uri.startswith("https://"):
            return test.replace('https://127.0.0.1:8443/', 'http/tests/')

        raise NotImplementedError('unknown url type: %s' % uri)
开发者ID:Andolamin,项目名称:LunaSysMgr,代码行数:25,代码来源:base.py


示例2: test_basic

    def test_basic(self):
        options, args = parse_args(tests_included=True)
        logging_stream = StringIO.StringIO()
        host = MockHost()
        port_obj = host.port_factory.get(options.platform, options)
        details = run_webkit_tests.run(port_obj, options, args, logging_stream)

        # These numbers will need to be updated whenever we add new tests.
        self.assertEqual(details.initial_results.total, test.TOTAL_TESTS)
        self.assertEqual(details.initial_results.expected_skips, test.TOTAL_SKIPS)
        self.assertEqual(len(details.initial_results.unexpected_results_by_name), test.UNEXPECTED_PASSES + test.UNEXPECTED_FAILURES)
        self.assertEqual(details.exit_code, test.UNEXPECTED_FAILURES)
        self.assertEqual(details.retry_results.total, test.TOTAL_RETRIES)

        one_line_summary = "%d tests ran as expected, %d didn't:\n" % (
            details.initial_results.total - details.initial_results.expected_skips - len(details.initial_results.unexpected_results_by_name),
            len(details.initial_results.unexpected_results_by_name))
        self.assertTrue(one_line_summary in logging_stream.buflist)

        # Ensure the results were summarized properly.
        self.assertEqual(details.summarized_results['num_regressions'], details.exit_code)

        # Ensure the image diff percentage is in the results.
        self.assertEqual(details.summarized_results['tests']['failures']['expected']['image.html']['image_diff_percent'], 1)

        # Ensure the results were written out and displayed.
        full_results_text = host.filesystem.read_text_file('/tmp/layout-test-results/full_results.json')
        json_to_eval = full_results_text.replace("ADD_RESULTS(", "").replace(");", "")
        self.assertEqual(json.loads(json_to_eval), details.summarized_results)

        self.assertEqual(host.user.opened_urls, [path.abspath_to_uri(MockHost().platform, '/tmp/layout-test-results/results.html')])
开发者ID:Anthony-Biget,项目名称:openjfx,代码行数:31,代码来源:run_webkit_tests_integrationtest.py


示例3: test_results_directory_default

    def test_results_directory_default(self):
        # We run a configuration that should fail, to generate output, then
        # look for what the output results url was.

        # This is the default location.
        _, _, user = logging_run(tests_included=True)
        self.assertEqual(user.opened_urls, [path.abspath_to_uri(MockHost().platform, '/tmp/layout-test-results/results.html')])
开发者ID:Anthony-Biget,项目名称:openjfx,代码行数:7,代码来源:run_webkit_tests_integrationtest.py


示例4: test_to_uri

    def test_to_uri(self, test_name):
        """Convert a test name to a URI."""
        LAYOUTTEST_HTTP_DIR = "http/tests/"
        LAYOUTTEST_WEBSOCKET_DIR = "http/tests/websocket/tests/"

        port = None

        relative_path = test_name
        if (relative_path.startswith(LAYOUTTEST_WEBSOCKET_DIR)
            or relative_path.startswith(LAYOUTTEST_HTTP_DIR)):
            relative_path = relative_path[len(LAYOUTTEST_HTTP_DIR):]
            port = 8000

        # Make http/tests/local run as local files. This is to mimic the
        # logic in run-webkit-tests.
        #
        # TODO(dpranke): remove the SSL reference?
        if (port and not relative_path.startswith("local/")):
            if relative_path.startswith("ssl/"):
                port += 443
                protocol = "https"
            else:
                protocol = "http"
            return "%s://127.0.0.1:%u/%s" % (protocol, port, relative_path)

        return path.abspath_to_uri(self.abspath_for_test(test_name))
开发者ID:Andolamin,项目名称:LunaSysMgr,代码行数:26,代码来源:base.py


示例5: test_abspath_to_uri_escaping_cygwin

 def test_abspath_to_uri_escaping_cygwin(self):
     if sys.platform != "cygwin":
         return
     self.assertEqual(
         path.abspath_to_uri(self.platforminfo(), "/cygdrive/c/foo/bar + baz%.html"),
         "file:///C:/foo/bar%20+%20baz%25.html",
     )
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:7,代码来源:path_unittest.py


示例6: test_results_directory_relative

 def test_results_directory_relative(self):
     # We run a configuration that should fail, to generate output, then
     # look for what the output results url was.
     host = MockHost()
     host.filesystem.maybe_make_directory('/tmp/cwd')
     host.filesystem.chdir('/tmp/cwd')
     _, _, user = logging_run(['--results-directory=foo'], tests_included=True, host=host)
     self.assertEqual(user.opened_urls, [path.abspath_to_uri(host.platform, '/tmp/cwd/foo/results.html')])
开发者ID:Anthony-Biget,项目名称:openjfx,代码行数:8,代码来源:run_webkit_tests_integrationtest.py


示例7: test_results_directory_absolute

    def test_results_directory_absolute(self):
        # We run a configuration that should fail, to generate output, then
        # look for what the output results url was.

        host = MockHost()
        with host.filesystem.mkdtemp() as tmpdir:
            _, _, user = logging_run(['--results-directory=' + str(tmpdir)], tests_included=True, host=host)
            self.assertEqual(user.opened_urls, [path.abspath_to_uri(host.platform, host.filesystem.join(tmpdir, 'results.html'))])
开发者ID:Anthony-Biget,项目名称:openjfx,代码行数:8,代码来源:run_webkit_tests_integrationtest.py


示例8: test_test_to_uri

    def test_test_to_uri(self):
        port = Port()
        layout_test_dir = port.layout_tests_dir()
        test = 'foo/bar.html'
        path = port._filesystem.join(layout_test_dir, test)
        if sys.platform == 'win32':
            path = path.replace("\\", "/")

        self.assertEqual(port.test_to_uri(test), abspath_to_uri(path))
开发者ID:Andolamin,项目名称:LunaSysMgr,代码行数:9,代码来源:base_unittest.py


示例9: test_to_uri

    def test_to_uri(self, test_name):
        """Convert a test name to a URI."""
        if not self.is_http_test(test_name):
            return path.abspath_to_uri(self._port.host.platform, self._port.abspath_for_test(test_name))

        relative_path = test_name[len(self.HTTP_DIR):]

        # TODO(dpranke): remove the SSL reference?
        if relative_path.startswith("ssl/"):
            return "https://127.0.0.1:8443/" + relative_path
        return "http://127.0.0.1:8000/" + relative_path
开发者ID:Igalia,项目名称:blink,代码行数:11,代码来源:driver.py


示例10: test_to_uri

    def test_to_uri(self, test_name):
        """Convert a test name to a URI.

        Tests which have an 'https' directory in their paths (e.g.
        '/http/tests/security/mixedContent/https/test1.html') will be loaded
        over HTTPS; all other tests over HTTP.
        """
        if not self.is_http_test(test_name):
            return path.abspath_to_uri(self._port.host.platform, self._port.abspath_for_test(test_name))

        if "/https/" in test_name:
            return "https://127.0.0.1:8443/" + test_name
        return "http://127.0.0.1:8000/" + test_name
开发者ID:esprehn,项目名称:mojo,代码行数:13,代码来源:driver.py


示例11: uri_to_test

    def uri_to_test(self, uri):
        """Return the base layout test name for a given URI.

        This returns the test name for a given URI, e.g., if you passed in
        "file:///src/LayoutTests/fast/html/keygen.html" it would return
        "fast/html/keygen.html".

        """
        if uri.startswith("file:///"):
            return uri[len(path.abspath_to_uri(self._port.layout_tests_dir()) + "/") :]
        if uri.startswith("http://"):
            return uri.replace("http://127.0.0.1:8000/", self.HTTP_DIR)
        if uri.startswith("https://"):
            return uri.replace("https://127.0.0.1:8443/", self.HTTP_DIR)
        raise NotImplementedError("unknown url type: %s" % uri)
开发者ID:sukwon0709,项目名称:Artemis,代码行数:15,代码来源:driver.py


示例12: test_filename_to_uri

    def test_filename_to_uri(self):
        port = base.Port()
        layout_test_dir = port.layout_tests_dir()
        test_file = port._filesystem.join(layout_test_dir, "foo", "bar.html")

        # On Windows, absolute paths are of the form "c:\foo.txt". However,
        # all current browsers (except for Opera) normalize file URLs by
        # prepending an additional "/" as if the absolute path was
        # "/c:/foo.txt". This means that all file URLs end up with "file:///"
        # at the beginning.
        if sys.platform == "win32":
            prefix = "file:///"
            path = test_file.replace("\\", "/")
        else:
            prefix = "file://"
            path = test_file

        self.assertEqual(port.filename_to_uri(test_file), abspath_to_uri(test_file))
开发者ID:gwindlord,项目名称:lenovo_b6000-8000_kernel_source,代码行数:18,代码来源:base_unittest.py


示例13: uri_to_test

    def uri_to_test(self, uri):
        """Return the base layout test name for a given URI.

        This returns the test name for a given URI, e.g., if you passed in
        "file:///src/LayoutTests/fast/html/keygen.html" it would return
        "fast/html/keygen.html".

        """
        if uri.startswith("file:///"):
            prefix = path.abspath_to_uri(self._port.host.platform, self._port.layout_tests_dir())
            if not prefix.endswith('/'):
                prefix += '/'
            return uri[len(prefix):]
        if uri.startswith("http://"):
            return uri.replace('http://127.0.0.1:8000/', self.HTTP_DIR)
        if uri.startswith("https://"):
            return uri.replace('https://127.0.0.1:8443/', self.HTTP_DIR)
        raise NotImplementedError('unknown url type: %s' % uri)
开发者ID:335969568,项目名称:Blink-1,代码行数:18,代码来源:driver.py


示例14: uri_to_test

    def uri_to_test(self, uri):
        """Return the base layout test name for a given URI.

        This returns the test name for a given URI, e.g., if you passed in
        "file:///src/LayoutTests/fast/html/keygen.html" it would return
        "fast/html/keygen.html".
        """

        # This looks like a bit of a hack, since the uri is used instead of test name.
        hostname, insecure_port, secure_port = self._get_http_host_and_ports_for_test(uri)

        if uri.startswith("file:///"):
            prefix = path.abspath_to_uri(self._port.host.platform, self._port.layout_tests_dir())
            if not prefix.endswith('/'):
                prefix += '/'
            return uri[len(prefix):]
        if uri.startswith("http://"):
            return uri.replace('http://%s:%d/' % (hostname, insecure_port), self.HTTP_DIR)
        if uri.startswith("https://"):
            return uri.replace('https://%s:%d/' % (hostname, secure_port), self.HTTP_DIR)
        raise NotImplementedError('unknown url type: %s' % uri)
开发者ID:mirror,项目名称:chromium,代码行数:21,代码来源:driver.py


示例15: test_to_uri

    def test_to_uri(self, test_name):
        """Convert a test name to a URI.

        Tests which have an 'https' directory in their paths (e.g.
        '/http/tests/security/mixedContent/https/test1.html') or '.https.' in
        their name (e.g. 'http/tests/security/mixedContent/test1.https.html') will
        be loaded over HTTPS; all other tests over HTTP.
        """
        using_wptserve = self._port.should_use_wptserve(test_name)

        if not self.is_http_test(test_name) and not using_wptserve:
            return path.abspath_to_uri(self._port.host.platform, self._port.abspath_for_test(test_name))

        if using_wptserve:
            test_dir_prefix = self.WPT_DIR
        else:
            test_dir_prefix = self.HTTP_DIR

        relative_path = test_name[len(test_dir_prefix):]
        hostname, insecure_port, secure_port = self._get_http_host_and_ports_for_test(test_name)

        if "/https/" in test_name or ".https." in test_name:
            return "https://%s:%d/%s" % (hostname, secure_port, relative_path)
        return "http://%s:%d/%s" % (hostname, insecure_port, relative_path)
开发者ID:mirror,项目名称:chromium,代码行数:24,代码来源:driver.py


示例16: test_abspath_to_uri_win

 def test_abspath_to_uri_win(self):
     if sys.platform != 'win32':
         return
     self.assertEqual(path.abspath_to_uri(self.platforminfo(), 'c:\\foo\\bar.html'),
                      'file:///c:/foo/bar.html')
开发者ID:335969568,项目名称:Blink-1,代码行数:5,代码来源:path_unittest.py


示例17: test_abspath_to_uri_win

 def test_abspath_to_uri_win(self):
     if not sys.platform.startswith('win'):
         return
     self.assertEqual(path.abspath_to_uri(self.platforminfo(), 'c:\\foo\\bar.html'),
                      'file:///c:/foo/bar.html')
开发者ID:edcwconan,项目名称:webkit,代码行数:5,代码来源:path_unittest.py


示例18: show_results_html_file

 def show_results_html_file(self, results_filename):
     self._run_script('run-safari', [abspath_to_uri(results_filename)])
开发者ID:Moondee,项目名称:Artemis,代码行数:2,代码来源:win.py


示例19: show_results_html_file

 def show_results_html_file(self, results_filename):
     self._run_script('run-safari', [abspath_to_uri(SystemHost().platform, results_filename)])
开发者ID:kodybrown,项目名称:webkit,代码行数:2,代码来源:win.py


示例20: test_abspath_to_uri_escaping_unixy

 def test_abspath_to_uri_escaping_unixy(self):
     self.assertEqual(path.abspath_to_uri(MockPlatformInfo(), '/foo/bar + baz%?.html'),
                      'file:///foo/bar%20+%20baz%25%3F.html')
开发者ID:335969568,项目名称:Blink-1,代码行数:3,代码来源:path_unittest.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python path.cygpath函数代码示例发布时间:2022-05-26
下一篇:
Python outputcapture.OutputCapture类代码示例发布时间: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