This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pathlib: test_resolve_common fails on Windows w/ longusername
Type: behavior Stage: resolved
Components: Tests, Windows Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Release Windows Store app containing Python
View: 34977
Assigned To: Nosy List: izbyshev, paul.moore, pitrou, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2018-02-22 09:40 by izbyshev, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5812 closed izbyshev, 2018-02-22 09:58
Messages (1)
msg312545 - (view) Author: Alexey Izbyshev (izbyshev) * (Python triager) Date: 2018-02-22 09:40
======================================================================
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 (#9949, #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.
History
Date User Action Args
2022-04-11 14:58:58adminsetgithub: 77088
2019-12-13 03:00:51cheryl.sabellasetstatus: open -> closed
superseder: Release Windows Store app containing Python
resolution: duplicate
stage: patch review -> resolved
2018-02-24 02:18:40terry.reedysettitle: pathlib: test_resolve_common fails on Windows -> pathlib: test_resolve_common fails on Windows w/ longusername
2018-02-22 09:58:20izbyshevsetkeywords: + patch
stage: patch review
pull_requests: + pull_request5587
2018-02-22 09:40:02izbyshevcreate