Commit Graph

76 Commits

Author SHA1 Message Date
Barney Gale baecfbd849
bpo-43757: Make pathlib use os.path.realpath() to resolve symlinks in a path (GH-25264)
Also adds a new "strict" argument to realpath() to avoid changing the default behaviour of pathlib while sharing the implementation.
2021-04-28 16:50:17 +01:00
Barney Gale 3f3d82b848
bpo-39899: os.path.expanduser(): don't guess other Windows users' home directories if the basename of the current user's home directory doesn't match their username. (GH-18841)
This makes `ntpath.expanduser()` match `pathlib.Path.expanduser()` in this regard, and is more in line with `posixpath.expanduser()`'s cautious approach.

Also remove the near-duplicate implementation of `expanduser()` in pathlib, and by doing so fix a bug where KeyError could be raised when expanding another user's home directory.
2021-04-07 23:50:13 +01:00
Hai Shi 598a951844
bpo-40275: Use new test.support helper submodules in tests (GH-21764) 2020-08-07 17:18:38 +02:00
Hai Shi 79bb2c93f2
bpo-40275: Use new test.support helper submodules in tests (GH-21743) 2020-08-06 13:51:29 +02:00
Hai Shi 4660597b51
bpo-40275: Use new test.support helper submodules in tests (GH-21448) 2020-08-03 18:49:18 +02:00
Serhiy Storchaka 700cfa8c90
bpo-41069: Make TESTFN and the CWD for tests containing non-ascii characters. (GH-21035) 2020-06-25 17:56:31 +03:00
Steve Dower 7c6130c8c3
bpo-38453: Ensure correct short path is obtained for test (GH-17184) 2019-11-15 16:04:00 -08:00
Steve Dower abde52cd8e
bpo-38453: Ensure ntpath.realpath correctly resolves relative paths (GH-16967)
Ensure isabs() is always True for \\?\ prefixed paths
Avoid unnecessary usage of readlink() to avoid resolving broken links incorrectly
Ensure shutil tests run in test directory
2019-11-15 09:49:21 -08:00
Steve Dower a0e3d27e4e
bpo-38355: Fix ntpath.realpath failing on sys.executable (GH-16551) 2019-10-03 08:31:03 -07:00
Steve Dower 92521fea5d bpo-38081: Fixes ntpath.realpath('NUL') (GH-15899) 2019-09-11 10:48:36 +01:00
Steve Dower 97d7906e30 bpo-38087: Fix case sensitivity in test_pathlib and test_ntpath (GH-15850) 2019-09-10 14:52:48 +01:00
Steve Dower 06be2c7f35
bpo-9949: Call normpath() in realpath() and avoid unnecessary prefixes (GH-15369) 2019-08-21 16:45:02 -07:00
Steve Dower 75e064962e
bpo-9949: Enable symlink traversal for ntpath.realpath (GH-15287) 2019-08-21 13:43:06 -07:00
Zackery Spytz 9fe42b49c7 bpo-37393: Fix deprecation warnings in test_ntpath. (GH-14357)
eval() was being called an extra time without a filter for
deprecation warnings.
2019-06-25 09:49:46 +03:00
Anthony Sottile 25ec4a45dc bpo-36264: Don't honor POSIX HOME in os.path.expanduser on Windows (GH-12282) 2019-03-12 08:39:57 -07:00
Tim Graham d03b775781 bpo-31047: Fix ntpath.abspath to trim ending separator (GH-10082)
Regression in b0bf51b322.
2018-10-25 11:26:37 -04:00
Franz Wöllert d2e902e4fb bpo-31047: Fix ntpath.abspath for invalid paths (GH-8544) 2018-07-29 13:47:09 +01:00
Tim Golden ff64add8d4
bpo-34195: Fix case-sensitive comparison in test_nt_helpers (GH-8448)
* Fix case-sensitive comparison

test_nt_helpers assumed that two versions of a Windows path could be compared case-sensitively. This is not the case, and the difference can be triggered (apparently) by running the test on a path somewhere below a Junction.
2018-07-25 14:36:54 +01:00
Serhiy Storchaka b21d155f57
bpo-32964: Reuse a testing implementation of the path protocol in tests. (#5930) 2018-03-02 11:53:51 +02:00
Steve Dower 23ad6d0d1a
bpo-32556: nt._getfinalpathname, nt._getvolumepathname and nt._getdiskusage now correctly convert from bytes. (GH-5761) 2018-02-22 10:39:10 -08:00
Serhiy Storchaka 9ed707eb4c Issue #29197: Removed deprecated function ntpath.splitunc(). 2017-01-13 20:55:05 +02:00
Brett Cannon 3f9183b5ac Issue #26027, #27524: Add PEP 519/__fspath__() support to os and
os.path.

Thanks to Jelle Zijlstra for the initial patch against posixmodule.c.
2016-08-26 14:44:48 -07:00
Serhiy Storchaka 3822093143 Issue #10395: Added os.path.commonpath(). Implemented in posixpath and ntpath.
Based on patch by Rafik Draoui.
2015-03-31 15:31:53 +03:00
Serhiy Storchaka 1b87ae0c91 Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes. 2015-03-25 16:40:15 +02:00
Serhiy Storchaka 5106d044ec Issue #7665: Fixed tests test_ntpath and test_urllib2 when ran in the
directory containing a backslash.
2015-01-26 10:26:14 +02:00
Serhiy Storchaka ffc1e6d42b Issue #21493: Added test for ntpath.expanduser(). Original patch by
Claudiu Popa.
2014-05-28 18:11:29 +03:00
Serhiy Storchaka 7dfaa27fdd Issue #6815: os.path.expandvars() now supports non-ASCII environment
variables names and values.
2014-02-13 10:14:48 +02:00
Serhiy Storchaka dbb101909d Issue #6815: os.path.expandvars() now supports non-ASCII environment
variables names and values.
2014-02-13 10:13:53 +02:00
Serhiy Storchaka f5d2f22475 Issue #19456: ntpath.join() now joins relative paths correctly when a drive
is present.
2014-01-27 23:16:28 +02:00
Serhiy Storchaka c369c2c688 Issue #19456: ntpath.join() now joins relative paths correctly when a drive
is present.
2014-01-27 23:15:14 +02:00
Serhiy Storchaka cc83b0c8f6 Issue #19912: Fixed numerous bugs in ntpath.splitunc().
* splitunc() no more return illegal result for paths with redundant slashes.
* splitunc() now correctly processes the 'İ' character
  (U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE).
* Deprecation warnings now emitted for every use of splitunc().
* Added tests for splitunc().
2013-12-16 15:14:19 +02:00
Serhiy Storchaka 593568bf47 Issue #19912: Fixed numerous bugs in ntpath.splitunc().
* splitunc() no more return illegal result for paths with redundant slashes.
* splitunc() now correctly processes the 'İ' character
  (U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE).
* Deprecation warnings now emitted for every use of splitunc().
* Added tests for splitunc().
2013-12-16 15:13:28 +02:00
Serhiy Storchaka f5ad91c392 Issue #19911: ntpath.splitdrive() now correctly processes the 'İ' character
(U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE).
2013-12-16 14:36:10 +02:00
Serhiy Storchaka 3d7e11520e Issue #19911: ntpath.splitdrive() now correctly processes the 'İ' character
(U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE).
2013-12-16 14:34:55 +02:00
Zachary Ware 101d9e7250 Issue 19572: More silently skipped tests explicitly skipped. 2013-12-08 00:44:27 -06:00
Zachary Ware 9fe6d86709 Issue 19572: More silently skipped tests explicitly skipped. 2013-12-08 00:20:35 -06:00
Tim Golden b2fcebb018 issue9035: Prevent Windows-specific tests from running on non-Windows platforms 2013-08-01 13:58:58 +01:00
Tim Golden 6b528067c5 Issue #9035: os.path.ismount now recognises volumes mounted below
a drive root on Windows. Original patch by Atsuo Ishimoto.
2013-08-01 12:44:00 +01:00
Ezio Melotti d0dfe9ad46 #16852: test_genericpath, test_posixpath, test_ntpath, and test_macpath now work with unittest test discovery. Patch by Zachary Ware. 2013-01-10 03:12:50 +02:00
Victor Stinner 1ab6c2d2c2 Issue #13374: The Windows bytes API has been deprecated in the os module. Use
Unicode filenames instead of bytes filenames to not depend on the ANSI code
page anymore and to support any filename.
2011-11-15 22:27:41 +01:00
Hirokazu Yamamoto 26253bb09e Should use posix_error here. 2010-12-05 04:16:47 +00:00
Hirokazu Yamamoto b08820ad40 Issue #5117: Case normalization was needed on ntpath.relpath(). And
fixed root directory issue on posixpath.relpath(). (Ported working fixes
from ntpath)
2010-10-18 12:13:18 +00:00
Brian Curtin 13a0db5ddb Fix some errors that #7566 introduced on non-Windows platforms due to
an ImportError. Rearranged the import, faked out the implementation when
the import fails, and reorganized a test that depends on Win32 behavior.
2010-09-06 19:46:17 +00:00
Brian Curtin 6285774f06 Implement #7566 - os.path.sameopenfile for Windows.
This uses the GetFileInformationByHandle function to return a tuple of values
to identify a file, then ntpath.sameopenfile compares file tuples, which
is exposed as os.path.sameopenfile.
2010-09-06 17:07:27 +00:00
Georg Brandl cfb68218b7 #7909: the prefixes \\.\ and \\?\ indicate special Windows paths, do not try to manipulate them. See http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx for details. 2010-07-31 21:40:15 +00:00
Georg Brandl 1b37e8728c Merged revisions 78093 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78093 | georg.brandl | 2010-02-07 18:03:15 +0100 (So, 07 Feb 2010) | 1 line

  Remove unused imports in test modules.
........
2010-03-14 10:45:50 +00:00
Florent Xicluna c9c79784cf Merged revisions 78734-78735 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78734 | florent.xicluna | 2010-03-06 19:07:18 +0100 (sam, 06 mar 2010) | 2 lines

  Create test_genericpath.CommonTest and reuse it to test other path modules.
........
  r78735 | florent.xicluna | 2010-03-06 19:52:52 +0100 (sam, 06 mar 2010) | 2 lines

  Minor tweaking of previous r78734, and add a NEWS entry.
........
2010-03-08 12:24:53 +00:00
Ezio Melotti e96159335f Merged revisions 77727 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77727 | ezio.melotti | 2010-01-24 18:58:36 +0200 (Sun, 24 Jan 2010) | 1 line

  use assert[Not]IsInstance where appropriate
........
2010-01-24 19:26:24 +00:00
Mark Hammond 5a607a3ee5 Issue #5799: ntpath (ie, os.path on Windows) fully supports UNC pathnames.
By Larry Hastings, reviewed eric.smith and mark.hammond.
2009-05-06 08:04:54 +00:00
Walter Dörwald 155374d95d Merged revisions 72167 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72167 | walter.doerwald | 2009-05-01 19:35:37 +0200 (Fr, 01 Mai 2009) | 5 lines

  Make test.test_support.EnvironmentVarGuard behave like a dictionary.

  All changes are mirrored to the underlying os.environ dict, but rolled back
  on exit from the with block.
........
2009-05-01 19:58:58 +00:00