summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pathlib.py
Commit message (Collapse)AuthorAgeFilesLines
...
* bpo-46933: Make pwd module optional (GH-31700)Christian Heimes2022-03-071-0/+3
| | | Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* bpo-46556: emit `DeprecationWarning` from `pathlib.Path.__enter__()` (GH-30971)Barney Gale2022-02-081-4/+7
| | | | | In Python 3.9, Path.__exit__() was made a no-op and has never been documented. Co-authored-by: Brett Cannon <brett@python.org>
* bpo-46483: Remove `__class_getitem__` from `pathlib.PurePath` (GH-30848)Nikita Sobolev2022-02-031-9/+0
| | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* bpo-43012: remove `pathlib._Accessor` (GH-25701)Barney Gale2022-02-021-18/+17
| | | | | | | | | | | | | | | | Per Pitrou: > The original intent for the “accessor” thing was to have a variant that did all accesses under a filesystem tree in a race condition-free way using openat and friends. It turned out to be much too hairy to actually implement, so was entirely abandoned, but the accessor abstraction was left there. https://discuss.python.org/t/make-pathlib-extensible/3428/2 Accessors are: - Lacking any internal purpose - '_NormalAccessor' is the only implementation - Lacking any firm conceptual difference to `Path` objects themselves (inc. subclasses) - Non-public, i.e. underscore prefixed - '_Accessor' and '_NormalAccessor' - Unofficially used to implement customized `Path` objects, but once once [bpo-24132]() is addressed there will be a supported route for that. This patch preserves all existing behaviour.
* bpo-29688: document and test `pathlib.Path.absolute()` (GH-26153)Barney Gale2022-01-281-0/+58
| | | | Co-authored-by: Brett Cannon <brett@python.org> Co-authored-by: Brian Helba <brian.helba@kitware.com>
* bpo-46483: change `PurePath.__class_getitem__` to return `GenericAlias` ↵Nikita Sobolev2022-01-231-3/+9
| | | | (GH-30822)
* bpo-46150: ensure `fakeuser` does not exist in ↵Nikita Sobolev2021-12-241-5/+13
| | | | | `PosixPathTest.test_expanduser` (GH-30240) Ensure `fakeuser` does not exist in `PosixPathTest.test_expanduser`
* Allow test_pathlib to pass on systems where fakeuser exists. (GH-30244)Gregory P. Smith2021-12-241-1/+1
|
* Fix typos in the Lib directory (GH-28775)Christian Clauss2021-10-061-2/+2
| | | | | Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-27827: identify a greater range of reserved filename on Windows. (GH-26698)Barney Gale2021-07-281-8/+24
| | | | | | | `pathlib.PureWindowsPath.is_reserved()` now identifies as reserved filenames with trailing spaces or colons. Co-authored-by: Barney Gale <barney.gale@foundry.com> Co-authored-by: Eryk Sun <eryksun@gmail.com>
* bpo-38671: Add test that `pathlib.Path.resolve()` returns an absolute path. ↵Barney Gale2021-05-201-0/+10
| | | | | | | | (GH-26184) Issue should be fixed in bpo-43757 Co-Authored-by: Tzu-ping Chung <uranusjr@gmail.com>
* bpo-39950: Fix deprecation warning in test for `pathlib.Path.link_to()` ↵Barney Gale2021-05-161-1/+2
| | | | (GH-26155)
* bpo-39950: add `pathlib.Path.hardlink_to()` method that supersedes ↵Barney Gale2021-04-231-1/+20
| | | | | | | | | | | `link_to()` (GH-18909) The argument order of `link_to()` is reversed compared to what one may expect, so: a.link_to(b) Might be expected to create *a* as a link to *b*, in fact it creates *b* as a link to *a*, making it function more like a "link from". This doesn't match `symlink_to()` nor the documentation and doesn't seem to be the original author's intent. This PR deprecates `link_to()` and introduces `hardlink_to()`, which has the same argument order as `symlink_to()`.
* bpo-39899: os.path.expanduser(): don't guess other Windows users' home ↵Barney Gale2021-04-071-1/+1
| | | | | | | 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.
* bpo-39906: Add follow_symlinks parameter to pathlib.Path.stat() and chmod() ↵Barney Gale2021-04-071-0/+26
| | | | (GH-18864)
* bpo-31904: Skip os.path.expanduser() tests on VxWorks (GH-23776)pxinwr2020-12-151-0/+2
|
* bpo-31904: skip some tests related to fifo on VxWorks (GH-23473)pxinwr2020-11-281-0/+2
| | | On VxWork RTOS, FIFO must be created under directory "/fifos/". Some test cases related to fifo is invalid on VxWorks. So skip them.
* Added support for negative indexes to PurePath.parents (GH-21799)Yaroslav Pankovych2020-11-231-1/+4
| | | | | | | | | | This commit also fixes up some of the overlapping documentation changed in bpo-35498, which added support for indexing with slices. Fixes bpo-21041. https://bugs.python.org/issue21041 Co-authored-by: Paul Ganssle <p.ganssle@gmail.com> Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
* bpo-35498: Added slice support to PathLib parents attribute. (GH-11165)Joshua Cannon2020-11-201-0/+30
| | | Added slice support to the `pathlib.Path.parents` sequence. For a `Path` `p`, slices of `p.parents` should return the same thing as slices of `tuple(p.parents)`.
* bpo-23706: Add newline parameter to pathlib.Path.write_text (GH-22420) ↵Максим2020-10-211-0/+20
| | | | | | | | | (GH-22420) * Add _newline_ parameter to `pathlib.Path.write_text()` * Update documentation of `pathlib.Path.write_text()` * Add test case for `pathlib.Path.write_text()` calls with _newline_ parameter passed Automerge-Triggered-By: GH:methane
* bpo-33660: Fix PosixPath to resolve a relative path on rootDong-hee Na2020-08-271-0/+9
|
* bpo-40275: Use new test.support helper submodules in tests (GH-21451)Hai Shi2020-08-031-35/+37
|
* bpo-40148: Add PurePath.with_stem() (GH-19295)Tim Hoffmann2020-04-191-0/+31
| | | | Add PurePath.with_stem()
* bpo-39682: make `pathlib.Path` immutable by removing (undocumented) support ↵Barney Gale2020-04-011-7/+9
| | | | | | for "closing" a path by using it as a context manager (GH-18846) Support for using a path as a context manager remains, and is now a no-op.
* bpo-38894: Fix pathlib.Path.glob in the presence of symlinks and ↵Pablo Galindo2020-03-071-0/+36
| | | | | insufficient permissions (GH-18815) Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
* bpo-38883: Don't use POSIX `$HOME` in `pathlib.Path.home/expanduser` on ↵Christoph Reiter2020-01-281-8/+14
| | | | | | | | | Windows (GH-17961) In bpo-36264 os.path.expanduser was changed to ignore HOME on Windows. Path.expanduser/home still honored HOME despite being documented as behaving the same as os.path.expanduser. This makes them also ignore HOME so that both implementations behave the same way again.
* bpo-38811: Check for presence of os.link method in pathlib (GH-17225)Toke Høiland-Jørgensen2019-12-161-0/+10
| | | | | | | | | | | Commit 6b5b013bcc22 ("bpo-26978: Implement pathlib.Path.link_to (Using os.link) (GH-12990)") introduced a new link_to method in pathlib. However, this makes pathlib crash when the 'os' module is missing a 'link' method. Fix this by checking for the presence of the 'link' method on pathlib module import, and if it's not present, turn it into a runtime error like those emitted when there is no lchmod() or symlink(). Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
* bpo-38994: Implement __class_getitem__ for PathLike (GH-17498)Batuhan Taşkaya2019-12-081-0/+3
| | | https://bugs.python.org/issue38994
* Revert "bpo-38811: Check for presence of os.link method in pathlib. ↵Victor Stinner2019-11-181-19/+0
| | | | | (GH-17170)" (#17219) This reverts commit 111772fc27cfe388bc060f019d68a3e33481ec65.
* bpo-38811: Check for presence of os.link method in pathlib. (GH-17170)Toke Høiland-Jørgensen2019-11-171-0/+19
| | | | | Fix also the Path.symplink() method implementation for the case when symlinks are not supported.
* bpo-30618: add readlink to pathlib.Path (GH-8285)Girts2019-10-231-0/+10
| | | | | | | | | | | This adds a "readlink" method to pathlib.Path objects that calls through to os.readlink. https://bugs.python.org/issue30618 Automerge-Triggered-By: @gpshead
* bpo-31202: Preserve case of literal parts in Path.glob() on Windows. (GH-16860)Serhiy Storchaka2019-10-211-0/+4
|
* bpo-37935: Added tests for os.walk(), glob.iglob() and Path.glob() (GH-15956)Serhiy Storchaka2019-09-121-0/+17
| | | | | Test that they do not keep too many file descriptors open for the host OS in a reasonable test scenario. See [bpo-37935](https://bugs.python.org/issue37935).
* bpo-31163: Added return values to pathlib.Path instance's rename and replace ↵hui shang2019-09-111-4/+8
| | | | | methods. (GH-13582) * bpo-31163: Added return values to pathlib.Path instance's rename and replace methods.
* bpo-38087: Fix case sensitivity in test_pathlib and test_ntpath (GH-15850)Steve Dower2019-09-101-16/+19
|
* bpo-37689: add Path.is_relative_to() method (GH-14982)Hai Shi2019-08-131-0/+87
|
* bpo-34775: Return NotImplemented in PurePath division. (GH-9509)aiudirog2019-08-081-0/+41
|
* bpo-36035: fix Path.rglob for broken links (GH-11988)Jörg Stucke2019-05-211-2/+6
| | | Links creating an infinite symlink loop would raise an exception.
* bpo-33123: pathlib: Add missing_ok parameter to Path.unlink (GH-6191)‮zlohhcuB treboR2019-05-151-0/+5
| | | | | | Similarly to how several pathlib file creation functions have an "exists_ok" parameter, we should introduce "missing_ok" that makes removal functions not raise an exception when a file or directory is already absent. IMHO, this should cover Path.unlink and Path.rmdir. Note, Path.resolve() has a "strict" parameter since 3.6 that does the same thing. Naming this of this new parameter tries to be consistent with the "exists_ok" parameter as that is more explicit about what it does (as opposed to "strict"). https://bugs.python.org/issue33123
* bpo-26978: Implement pathlib.Path.link_to (Using os.link) (GH-12990)Joannah Nanjekye2019-05-041-0/+19
|
* bpo-35488: Add tests for ** glob matching in pathlib (GH-11171)Anthony Shaw2019-01-061-114/+117
|
* bpo-34977: Add Windows App Store package (GH-11027)Steve Dower2018-12-111-1/+1
| | | Also adds the PC/layout script for generating layouts on Windows.
* Revert "bpo-34977: Add Windows App Store package (GH-10245)" (GH-11019)Victor Stinner2018-12-071-1/+1
| | | This reverts commit 468a15aaf9206448a744fc5eab3fc21f51966aad.
* bpo-34977: Add Windows App Store package (GH-10245)Steve Dower2018-12-071-1/+1
|
* bpo-33721: Make some os.path functions and pathlib.Path methods be tolerant ↵Serhiy Storchaka2018-09-181-1/+28
| | | | | | | | | | to invalid paths. (#7695) Such functions as os.path.exists(), os.path.lexists(), os.path.isdir(), os.path.isfile(), os.path.islink(), and os.path.ismount() now return False instead of raising ValueError or its subclasses UnicodeEncodeError and UnicodeDecodeError for paths that contain characters or bytes unrepresentative at the OS level.
* bpo-33635: Handling Bad file descriptor in Path.is_file and related. (GH-8542)Przemysław Spodymek2018-08-271-0/+24
|
* bpo-34333: Fix %-formatting in Path.with_suffix() (GH-8663)Berker Peksag2018-08-111-0/+2
|
* bpo-33522: Enable CI builds on Visual Studio Team Services (#6865)Steve Dower2018-05-161-1/+1
|
* bpo-32601: Let test_expanduser use the same user if no others found. (GH-5246)Anders Kaseorg2018-05-141-0/+3
| | | | | This happens in the NixOS build sandbox, for example, where the only other user is nobody with home directory /.
* bpo-32964: Reuse a testing implementation of the path protocol in tests. (#5930)Serhiy Storchaka2018-03-021-6/+3
|