Commit Graph

72 Commits

Author SHA1 Message Date
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 3deeeb0c39 Issue #21883: os.path.join() and os.path.relpath() now raise a TypeError with
more helpful error message for unsupported or mismatched types of arguments.
2014-10-04 14:58:43 +03:00
Serhiy Storchaka 1fa36268cf Issue #22034: Improve handling of wrong argument types in posixpath.join(). 2014-08-24 12:23:36 +03:00
Serhiy Storchaka 549c1972f2 Issue #22034: Got rid of misleading error message for bytearray arguments in
posixpath.join().
2014-08-24 12:18:09 +03:00
Ezio Melotti 79ec9f0ec9 #17809: merge with 3.3. 2013-05-09 15:24:30 +03:00
Ezio Melotti ce82d57c74 #17809: fix a test failure in test_expanduser when $HOME has a trailing /. Patch by Kubilay Kocak. 2013-05-09 15:19:45 +03:00
Ezio Melotti dc99e0d396 #17315: merge with 3.3. 2013-03-01 21:00:48 +02:00
Ezio Melotti 7b3e571c16 #17315: merge with 3.2. 2013-03-01 21:00:05 +02:00
Ezio Melotti 136726c59f #17315: unlink a file that test_posixpath was leaving around. 2013-03-01 20:59:17 +02:00
Serhiy Storchaka 789ee0f31f Disable posixpath.realpath() tests on Windows (fix for issue #6975). 2013-02-18 13:33:37 +02:00
Serhiy Storchaka 41d4ebbf43 Disable posixpath.realpath() tests on Windows (fix for issue #6975). 2013-02-18 13:33:13 +02:00
Serhiy Storchaka 1548ed6698 Disable posixpath.realpath() tests on Windows (fix for issue #6975). 2013-02-18 13:32:30 +02:00
Serhiy Storchaka 2a47954895 Fix posixpath.realpath() for multiple pardirs (fixes issue #6975). 2013-02-18 12:22:05 +02:00
Serhiy Storchaka 407aa2df2a Fix posixpath.realpath() for multiple pardirs (fixes issue #6975). 2013-02-18 12:21:30 +02:00
Serhiy Storchaka 467393dff5 Fix posixpath.realpath() for multiple pardirs (fixes issue #6975). 2013-02-18 12:21:04 +02:00
Serhiy Storchaka f2619236eb Issue #6975: os.path.realpath() now correctly resolves multiple nested symlinks on POSIX platforms. 2013-02-10 12:24:06 +02:00
Serhiy Storchaka d83c82440b Issue #6975: os.path.realpath() now correctly resolves multiple nested symlinks on POSIX platforms. 2013-02-10 12:23:10 +02:00
Serhiy Storchaka df32691e6f Issue #6975: os.path.realpath() now correctly resolves multiple nested symlinks on POSIX platforms. 2013-02-10 12:22:07 +02:00
Ezio Melotti 11b3a6056f #16852: merge with 3.3. 2013-01-10 03:29:45 +02: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
Brian Curtin 490b32a397 Fix #11939. Set st_dev attribute on Windows to simplify os.path.samefile.
By setting the st_dev attribute, we can then remove some Windows-specific
code and move os.path.samefile/sameopenfile/samestat to Lib/genericpath.py
so all platforms share the same implementation.
2012-12-26 07:03:03 -06:00
Hynek Schlawack 11718620ef Use posixpath.join() explicitely in posixpath.join() test
Used os.path.join before which has different semantics on Windows.
2012-07-17 14:29:33 +02:00
Hynek Schlawack 0b350c6b3e Use posixpath.join() explicitely in posixpath.join() test
Used os.path.join before which has different semantics on Windows.
2012-07-17 14:28:44 +02:00
Hynek Schlawack 1815191f17 #15377: Make posixpath.join() more strict when checking for str/bytes mix
Based on a patch by Nick Coghlan.
2012-07-17 13:10:15 +02:00
Hynek Schlawack c5a4566922 #15377: Make posixpath.join() more strict when checking for str/bytes mix
Based on a patch by Nick Coghlan.
2012-07-17 13:05:43 +02:00
Hynek Schlawack 1c4eb2c09a Fix context manager use in posixpath.join() tests
The asserts were useless (and buggy).
2012-07-17 10:50:30 +02:00
Hynek Schlawack 7cdc2bdd0d Fix context manager use in posixpath.join() tests
The asserts were useless (and buggy).
2012-07-17 10:48:19 +02:00
Hynek Schlawack 9ac4d8808f #15180: Clarify posixpath.join() error message when mixing str & bytes 2012-07-15 16:46:23 +02:00
Hynek Schlawack 4774946c3b #15180: Clarify posixpath.join() error message when mixing str & bytes 2012-07-15 16:21:30 +02:00
Jesus Cea b58ab2c6aa MERGE: Closes #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/' 2012-05-10 05:16:41 +02:00
Jesus Cea 7f0d88860f Closes #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/' 2012-05-10 05:10: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
Michael Foord 07926f024a Closes issue 11503. Improves test coverage of posixpath. 2011-03-16 17:19:16 -04:00
Brian Curtin 3b4499c5c7 Fix #9333. The symlink function is always available now, raising OSError
when the user doesn't hold the symbolic link privilege rather than hiding it.
2010-12-28 14:31:47 +00:00
Brian Curtin 52173d4959 Fix #9333. Expose os.symlink on Windows only when usable.
In order to create symlinks on Windows, SeCreateSymbolicLinkPrivilege
is an account privilege that is required to be held by the user. Not only
must the privilege be enabled for the account, the activated privileges for
the currently running application must be adjusted to enable the requested
privilege.

Rather than exposing an additional function to be called prior to the user's
first os.symlink call, we handle the AdjustTokenPrivileges Windows API call
internally and only expose os.symlink when the privilege escalation was
successful.

Due to the change of only exposing os.symlink when it's available, we can
go back to the original test skipping methods of checking via `hasattr`.
2010-12-02 18:29:18 +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 16633fa497 Fix the breakage of Lib/tarfile.py on non-Windows platforms due to
using WindowsError in a try/except. Only add WindowsError to the list of
exceptions to catch when we are actually running on Windows.

Additionally, add a call that was left out in test_posixpath.

Thanks Amaury, Antoine, and Jason.
2010-07-09 13:54:27 +00:00
Brian Curtin d40e6f70a5 Implement #1578269. Patch by Jason R. Coombs.
Added Windows support for os.symlink when run on Windows 6.0 or greater,
aka Vista. Previous Windows versions will raise NotImplementedError
when trying to symlink.

Includes numerous test updates and additions to test_os, including
a symlink_support module because of the fact that privilege escalation
is required in order to run the tests to ensure that the user is able
to create symlinks. By default, accounts do not have the required
privilege, so the escalation code will have to be exposed later (or
documented on how to do so). I'll be following up with that work next.

Note that the tests use ctypes, which was agreed on during the PyCon
language summit.
2010-07-08 21:39:08 +00:00
Georg Brandl 89fad14944 Merged revisions 78018,78035-78040,78042-78043,78046,78048-78052,78054,78059,78075-78080 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78018 | georg.brandl | 2010-02-06 11:08:21 +0100 (Sa, 06 Feb 2010) | 1 line

  #7864: make deprecation notices a bit clearer.
........
  r78035 | georg.brandl | 2010-02-06 23:44:17 +0100 (Sa, 06 Feb 2010) | 1 line

  Fix duplicate import.
........
  r78036 | georg.brandl | 2010-02-06 23:49:47 +0100 (Sa, 06 Feb 2010) | 1 line

  Remove unused import.
........
  r78037 | georg.brandl | 2010-02-06 23:59:15 +0100 (Sa, 06 Feb 2010) | 1 line

  No need to assign the results of expressions used only for side effects.
........
  r78038 | georg.brandl | 2010-02-07 00:02:29 +0100 (So, 07 Feb 2010) | 1 line

  Add a missing import.
........
  r78039 | georg.brandl | 2010-02-07 00:06:24 +0100 (So, 07 Feb 2010) | 1 line

  Add missing imports.
........
  r78040 | georg.brandl | 2010-02-07 00:08:00 +0100 (So, 07 Feb 2010) | 1 line

  Fix a few UnboundLocalErrors in test_long.
........
  r78042 | georg.brandl | 2010-02-07 00:12:12 +0100 (So, 07 Feb 2010) | 1 line

  Add missing import.
........
  r78043 | georg.brandl | 2010-02-07 00:12:19 +0100 (So, 07 Feb 2010) | 1 line

  Remove duplicate test method.
........
  r78046 | georg.brandl | 2010-02-07 00:18:00 +0100 (So, 07 Feb 2010) | 1 line

  Fix various missing import/unbound name errors.
........
  r78048 | georg.brandl | 2010-02-07 00:23:45 +0100 (So, 07 Feb 2010) | 1 line

  We heard you like test failures so we put unbound locals in your test so that you can fail while you fail.
........
  r78049 | georg.brandl | 2010-02-07 00:33:33 +0100 (So, 07 Feb 2010) | 1 line

  Fix import/access for some identifiers.  _TestSharedCTypes does not seem to be executed?
........
  r78050 | georg.brandl | 2010-02-07 00:34:10 +0100 (So, 07 Feb 2010) | 1 line

  Fix more unbound locals in code paths that do not seem to be used.
........
  r78051 | georg.brandl | 2010-02-07 00:53:52 +0100 (So, 07 Feb 2010) | 1 line

  Add missing import when running these tests standalone.
........
  r78052 | georg.brandl | 2010-02-07 00:54:04 +0100 (So, 07 Feb 2010) | 1 line

  Add missing import when running these tests standalone.
........
  r78054 | georg.brandl | 2010-02-07 00:58:25 +0100 (So, 07 Feb 2010) | 1 line

  Add missing import.
........
  r78059 | georg.brandl | 2010-02-07 12:34:15 +0100 (So, 07 Feb 2010) | 1 line

  Use "regexp" consistently.
........
  r78075 | georg.brandl | 2010-02-07 13:16:12 +0100 (So, 07 Feb 2010) | 1 line

  Fix another duplicated test method.
........
  r78076 | georg.brandl | 2010-02-07 13:19:43 +0100 (So, 07 Feb 2010) | 1 line

  Fix wrong usage of "except X, Y:".
........
  r78077 | georg.brandl | 2010-02-07 13:25:50 +0100 (So, 07 Feb 2010) | 1 line

  Fix two redefined test methods.
........
  r78078 | georg.brandl | 2010-02-07 13:27:06 +0100 (So, 07 Feb 2010) | 1 line

  Fix a redefined test method.
........
  r78079 | georg.brandl | 2010-02-07 13:34:26 +0100 (So, 07 Feb 2010) | 1 line

  Add a minimal test for fnmatchcase().
........
  r78080 | georg.brandl | 2010-02-07 13:55:12 +0100 (So, 07 Feb 2010) | 1 line

  Remove duplicate test method.
........
2010-03-14 10:23:39 +00:00
Florent Xicluna e3ed2e02be Merge other tests from test_*path.py into test_genericpath.CommonTest, and do some cleanup. 2010-03-08 12:42:20 +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 a11865b8c6 Merged revisions 78249 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78249 | ezio.melotti | 2010-02-20 11:40:07 +0200 (Sat, 20 Feb 2010) | 1 line

  Remove e assertIs definitions and use correct assert* methods.
........
2010-02-20 09:47:55 +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
Benjamin Peterson 577473fe68 use assert[Not]In where appropriate
A patch from Dave Malcolm.
2010-01-19 00:09:57 +00:00
Benjamin Peterson c9c0f201fe convert old fail* assertions to assert* 2009-06-30 23:06:06 +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
Hirokazu Yamamoto 7195963aa2 test_support was renamed to support on py3k. 2009-04-27 01:44:28 +00:00
Walter Dörwald b525e18500 Merged revisions 71984 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71984 | walter.doerwald | 2009-04-26 22:51:44 +0200 (So, 26 Apr 2009) | 2 lines

  Use test.test_support.EnvironmentVarGuard where tests change environment vars.
........
2009-04-26 21:39:21 +00:00
Benjamin Peterson ef3e4c2b4d Merged revisions 70980,71059,71225,71234,71241,71243,71249,71251,71255,71266,71299,71329,71397-71398,71486 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70980 | jack.diederich | 2009-04-01 15:26:13 -0500 (Wed, 01 Apr 2009) | 3 lines

  bounds check arguments to mmap.move().  All of them.  Really.
  fixes crasher on OS X 10.5
........
  r71059 | mark.dickinson | 2009-04-02 13:39:37 -0500 (Thu, 02 Apr 2009) | 2 lines

  sys.long_info attributes should be ints, not longs
........
  r71225 | georg.brandl | 2009-04-05 06:54:07 -0500 (Sun, 05 Apr 2009) | 1 line

  #5580: no need to use parentheses when converterr() argument is actually a type description.
........
  r71234 | georg.brandl | 2009-04-05 08:16:35 -0500 (Sun, 05 Apr 2009) | 1 line

  Whitespace normalization.
........
  r71241 | georg.brandl | 2009-04-05 09:48:49 -0500 (Sun, 05 Apr 2009) | 1 line

  #5471: fix expanduser() for $HOME set to "/".
........
  r71243 | georg.brandl | 2009-04-05 10:14:29 -0500 (Sun, 05 Apr 2009) | 1 line

  #5432: make plistlib docstring a raw string, since it contains examples with backslash escapes.
........
  r71249 | georg.brandl | 2009-04-05 11:30:43 -0500 (Sun, 05 Apr 2009) | 1 line

  #5444: adapt make.bat to new htmlhelp output file name.
........
  r71251 | georg.brandl | 2009-04-05 12:17:42 -0500 (Sun, 05 Apr 2009) | 1 line

  #5298: clarify docs about GIL by using more consistent wording.
........
  r71255 | georg.brandl | 2009-04-05 13:34:58 -0500 (Sun, 05 Apr 2009) | 1 line

  #602893: add indicator for current line in cgitb that doesnt rely on styling alone.
........
  r71266 | georg.brandl | 2009-04-05 15:23:13 -0500 (Sun, 05 Apr 2009) | 1 line

  Normalize issue referencing style.
........
  r71299 | gregory.p.smith | 2009-04-05 18:43:58 -0500 (Sun, 05 Apr 2009) | 3 lines

  Fixes issue5705: os.setuid() and friends did not accept the same range of
  values that pwd.getpwnam() returns.
........
  r71329 | benjamin.peterson | 2009-04-06 16:53:33 -0500 (Mon, 06 Apr 2009) | 1 line

  add create_connection to __all__ #5711
........
  r71397 | georg.brandl | 2009-04-08 11:36:39 -0500 (Wed, 08 Apr 2009) | 1 line

  Remove redundant backtick.
........
  r71398 | georg.brandl | 2009-04-08 11:39:04 -0500 (Wed, 08 Apr 2009) | 1 line

  Update ignore file for suspicious builder.
........
  r71486 | andrew.kuchling | 2009-04-11 11:18:14 -0500 (Sat, 11 Apr 2009) | 1 line

  Re-word
........
2009-04-11 19:48:14 +00:00
Guido van Rossum f0af3e30db Issue #3187: Better support for "undecodable" filenames. Code by Victor
Stinner, with small tweaks by GvR.
2008-10-02 18:55:37 +00:00