Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem in test test_unsupported_hashes on Windows #3951

Closed
pfmoore opened this issue Sep 2, 2016 · 2 comments
Closed

Problem in test test_unsupported_hashes on Windows #3951

pfmoore opened this issue Sep 2, 2016 · 2 comments
Labels
auto-locked Outdated issues that have been locked by automation C: tests Testing and related things OS: windows Windows specific type: maintenance Related to Development and Maintenance Processes

Comments

@pfmoore
Copy link
Member

pfmoore commented Sep 2, 2016

  • Pip version: Current master (without the recent commit to disable this test on Windows!)
  • Python version: 3.5.1
  • Operating System: Windows 10

Description:

Running the test_unsupported_hashes test fails on Windows

What I've run:

>.\.tox\py35\Scripts\py.test.exe -k test_unsupported_hashes
============================= test session starts =============================
platform win32 -- Python 3.5.1, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: C:\Work\Projects\pip, inifile: setup.cfg
plugins: catchlog-1.2.2, timeout-1.0.0, xdist-1.15.0
collected 694 items

tests\unit\test_req.py F

================================== FAILURES ===================================
_________________ TestRequirementSet.test_unsupported_hashes __________________

self = <tests.unit.test_req.TestRequirementSet object at 0x0000025D04F346A0>
data = <tests.lib.TestData object at 0x0000025D04F34A20>

    def test_unsupported_hashes(self, data):
        """VCS and dir links should raise errors when --require-hashes is
            on.

            In addition, complaints about the type of requirement (VCS or dir)
            should trump the presence or absence of a hash.

            """
        reqset = self.basic_reqset(require_hashes=True)
        reqset.add_requirement(
            list(process_line(
                'git+git://github.com/pypa/pip-test-package --hash=sha256:123',
                'file',
                1))[0])
        dir_path = data.packages.join('FSPkg')
        reqset.add_requirement(
            list(process_line(
                'file://%s' % (dir_path,),
                'file',
                2))[0])
        finder = PackageFinder([data.find_links], [], session=PipSession())
        sep = os.path.sep
        if sep == '\\':
            sep = '\\\\'  # This needs to be escaped for the regex
        assert_raises_regexp(
            HashErrors,
            r"Can't verify hashes for these requirements because we don't "
            r"have a way to hash version control repositories:\n"
            r"    git\+git://github\.com/pypa/pip-test-package \(from -r file "
            r"\(line 1\)\)\n"
            r"Can't verify hashes for these file:// requirements because they "
            r"point to directories:\n"
            r"    file://.*{sep}data{sep}packages{sep}FSPkg "
            "\(from -r file \(line 2\)\)".format(sep=sep),
            reqset.prepare_files,
>           finder)

tests\unit\test_req.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pip\req\req_set.py:370: in prepare_files
    ignore_dependencies=self.ignore_dependencies))
pip\req\req_set.py:471: in _prepare_file
    path = url_to_path(req_to_install.link.url)
pip\download.py:457: in url_to_path
    path = urllib_request.url2pathname(netloc + path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

url = '\\\\C|\\Users\\Gustav\\AppData\\Local\\Temp\\pytest-of-Gustav\\pytest-1\\test_unsupported_hashes0\\data\\packages\\FSPkg///C|/work/projects/pip'

    def url2pathname(url):
        """OS-specific conversion from a relative URL of the 'file' scheme
        to a file system path; not recommended for general use."""
        # e.g.
        #   ///C|/foo/bar/spam.foo
        # and
        #   ///C:/foo/bar/spam.foo
        # become
        #   C:\foo\bar\spam.foo
        import string, urllib.parse
        # Windows itself uses ":" even in URLs.
        url = url.replace(':', '|')
        if not '|' in url:
            # No drive specifier, just convert slashes
            if url[:4] == '////':
                # path is something like ////host/path/on/remote/host
                # convert this to \\host\path\on\remote\host
                # (notice halving of slashes at the start of the path)
                url = url[2:]
            components = url.split('/')
            # make sure not to convert quoted slashes :-)
            return urllib.parse.unquote('\\'.join(components))
        comp = url.split('|')
        if len(comp) != 2 or comp[0][-1] not in string.ascii_letters:
            error = 'Bad URL: ' + url
>           raise OSError(error)
E           OSError: Bad URL: \\C|\Users\Gustav\AppData\Local\Temp\pytest-of-Gustav\pytest-1\test_unsupported_hashes0\data\packages\FSPkg///C|/work/projects/pip

C:\Users\Gustav\AppData\Local\Programs\Python\Python35\Lib\nturl2path.py:28: OSError
------------------------------ Captured log call ------------------------------
pep425tags.py               79 DEBUG    Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
pep425tags.py               79 DEBUG    Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
req_set.py                 474 INFO     Collecting git+git://github.com/pypa/pip-test-package (from -r file (line 1))
=========================== pytest-warning summary ============================
WC1 None [pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.
============================ 693 tests deselected =============================
========= 1 failed, 693 deselected, 1 pytest-warnings in 1.83 seconds =========
@dstufft dstufft added the OS: windows Windows specific label Mar 30, 2017
@pradyunsg pradyunsg added type: bug A confirmed bug or unintended behavior C: tests Testing and related things labels Jul 20, 2017
@pradyunsg pradyunsg added type: maintenance Related to Development and Maintenance Processes and removed type: bug A confirmed bug or unintended behavior labels Oct 22, 2017
@chrahunt
Copy link
Member

chrahunt commented Sep 3, 2019

Is this still happening? Works for me on Windows 10/Python 3.7.

@chrahunt chrahunt added the S: awaiting response Waiting for a response/more information label Sep 3, 2019
@no-response
Copy link

no-response bot commented Oct 6, 2019

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@no-response no-response bot closed this as completed Oct 6, 2019
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Nov 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 5, 2019
@pradyunsg pradyunsg removed the S: awaiting response Waiting for a response/more information label Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation C: tests Testing and related things OS: windows Windows specific type: maintenance Related to Development and Maintenance Processes
Projects
None yet
Development

No branches or pull requests

4 participants