Skip to content

pathlib: test_resolve_common fails on Windows w/ longusername #77088

Closed

Description

@izbyshev
mannequin
BPO 32907
Nosy @pfmoore, @pitrou, @tjguk, @zware, @zooba, @izbyshev
PRs
  • bpo-32907: pathlib: Fix test_resolve_common failure on Windows #5812
  • Superseder
  • bpo-34977: Release Windows Store app containing Python
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-12-13.03:00:51.735>
    created_at = <Date 2018-02-22.09:40:02.586>
    labels = ['3.7', 'type-bug', 'tests', 'OS-windows']
    title = 'pathlib: test_resolve_common fails on Windows w/ longusername'
    updated_at = <Date 2019-12-13.03:00:51.734>
    user = 'https://github.com/izbyshev'

    bugs.python.org fields:

    activity = <Date 2019-12-13.03:00:51.734>
    actor = 'cheryl.sabella'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-12-13.03:00:51.735>
    closer = 'cheryl.sabella'
    components = ['Tests', 'Windows']
    creation = <Date 2018-02-22.09:40:02.586>
    creator = 'izbyshev'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32907
    keywords = ['patch']
    message_count = 1.0
    messages = ['312545']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'pitrou', 'tim.golden', 'zach.ware', 'steve.dower', 'izbyshev']
    pr_nums = ['5812']
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '34977'
    type = 'behavior'
    url = 'https://bugs.python.org/issue32907'
    versions = ['Python 3.6', 'Python 3.7']

    Activity

    1. izbyshev commented on Feb 22, 2018

      izbyshevmannequin
      MannequinAuthor

      ======================================================================
      FAIL: test_resolve_common (test.test_pathlib.PathTest)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "C:\workspace\cpython-3.8a\lib\test\test_pathlib.py", line 1538, in test_resolve_common
          self._check_resolve_relative(p, P(d, 'foo', 'in', 'spam'), False)
        File "C:\workspace\cpython-3.8a\lib\test\test_pathlib.py", line 1477, in _check_resolve
          self.assertEqual(q, expected)
      AssertionError: WindowsPath('C:/Users/longusername/AppData/Local/Temp/tmpbenaiqaa-[
      13 chars]pam') != WindowsPath('C:/Users/LONGUS~1/AppData/Local/Temp/tmpbenaiqaa-
      dirD/foo/in/spam')

      ======================================================================

      The problem is that the temporary directory path returned by tempfile.mkdtemp() contains the username in "short" (8.3) format, but Path.resolve() converts short names to long ones (thanks to ntpath._getfinalpathname()).

      Since os.path.realpath() still doesn't resolve symlinks on Windows (bpo-9949, bpo-14094), and users of ntpath._getfinalpathname() have to deal with '\\?\' prefix, I think I'll just use Path.resolve() for the tmp dir path as a workaround.

    2. changed the title [-]pathlib: test_resolve_common fails on Windows[/-] [+]pathlib: test_resolve_common fails on Windows w/ longusername[/+] on Feb 24, 2018
    3. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)end of lifeOS-windowstestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions