Skip to content

Parametrize tests for pathlib.Path.copy() #130614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
barneygale opened this issue Feb 26, 2025 · 3 comments
Open

Parametrize tests for pathlib.Path.copy() #130614

barneygale opened this issue Feb 26, 2025 · 3 comments
Labels
tests Tests in the Lib/test dir topic-pathlib type-feature A feature request or enhancement

Comments

@barneygale barneygale added tests Tests in the Lib/test dir topic-pathlib labels Feb 26, 2025
@srinivasreddy
Copy link
Contributor

I would like to work on it. If not taken

@Mr-Sunglasses
Copy link
Contributor

I would like to work on it. If not taken

Yes, Please go ahead :-)

@barneygale
Copy link
Contributor Author

I've already made a start on this, but I'll stop making changes and put a PR up so that others can contribute.

barneygale added a commit to barneygale/cpython that referenced this issue Feb 27, 2025
…paths

Add `test.test_pathlib.test_read`, which tests `ReadablePath` subclasses.
Tests are run against `ReadableZipPath`, `ReadableLocalPath`, and `Path`.
This test suite is mostly incomplete.

Add `test.test_pathlib.test_write`, which tests `WritablePath` subclasses.
Tests are run against `WritableZipPath`, `WritableLocalPath`, and `Path`.
This test suite is mostly complete.

Add `test.test_pathlib.support.zip_path`, which provides the `*ZipPath`
classes mentioned above. It also provides a `ZipPathGround` class that's
used by tests to make assertions about the contents of the zip file.

Add `test.test_pathlib.support.local_path`, which provides the `*LocalPath`
classes mentioned above. They're stripped-back versions of `pathlib.Path`,
basically. It also provides `LocalPathGround` class that's used by tests to
access the local filesystem.
barneygale added a commit to barneygale/cpython that referenced this issue Feb 27, 2025
…paths

Add `test.test_pathlib.test_read`, which tests `ReadablePath` subclasses.
Tests are run against `ReadableZipPath`, `ReadableLocalPath`, and `Path`.
This test suite is mostly incomplete.

Add `test.test_pathlib.test_write`, which tests `WritablePath` subclasses.
Tests are run against `WritableZipPath`, `WritableLocalPath`, and `Path`.
This test suite is mostly complete.

Add `test.test_pathlib.support.zip_path`, which provides the `*ZipPath`
classes mentioned above. It also provides a `ZipPathGround` class that's
used by tests to make assertions about the contents of the zip file.

Add `test.test_pathlib.support.local_path`, which provides the `*LocalPath`
classes mentioned above. They're stripped-back versions of `pathlib.Path`,
basically. It also provides `LocalPathGround` class that's used by tests to
access the local filesystem.
barneygale added a commit to barneygale/cpython that referenced this issue Mar 8, 2025
Test `pathlib.types._JoinablePath` in a dedicated test module. These tests
cover `LexicalPath`, `PurePath` and `Path`, where `LexicalPath` is defined
in a new `test.test_pathlib.support` package.
barneygale added a commit to barneygale/cpython that referenced this issue Mar 8, 2025
…e()`

In `pathlib.types._JoinablePath.with_name()`, retain any alternative path
separator preceding the old name, rather stripping and replacing it with a
primary separator. As a result, this method changes _only_ the name.
barneygale added a commit to barneygale/cpython that referenced this issue Mar 8, 2025
…atch()`

In `pathlib.types._JoinablePath.full_match()`, treat alternate path
separators in the path and pattern as if they were primary separators. e.g.
if the parser is `ntpath`, then `P(r'foo/bar\baz').full_match(r'*\*/*')` is
true.
barneygale added a commit that referenced this issue Mar 9, 2025
…130990)

In `pathlib.types._JoinablePath.with_name()`, retain any alternative path
separator preceding the old name, rather stripping and replacing it with a
primary separator. As a result, this method changes _only_ the name.
barneygale added a commit that referenced this issue Mar 9, 2025
#130991)

In `pathlib.types._JoinablePath.full_match()`, treat alternate path
separators in the path and pattern as if they were primary separators. e.g.
if the parser is `ntpath`, then `P(r'foo/bar\baz').full_match(r'*\*/*')` is
true.
barneygale added a commit to barneygale/cpython that referenced this issue Mar 9, 2025
barneygale added a commit that referenced this issue Mar 9, 2025
Test `pathlib.types._JoinablePath` in a dedicated test module. These tests
cover `LexicalPath`, `PurePath` and `Path`, where `LexicalPath` is defined
in a new `test.test_pathlib.support` package.
barneygale added a commit to barneygale/cpython that referenced this issue Mar 9, 2025
…ning

Test Windows-flavoured `pathlib.types._JoinablePath` in a dedicated test
module. These tests cover `LexicalWindowsPath`, `PureWindowsPath` and
`WindowsPath`, where `LexicalWindowsPath` is a simple implementation of
`_JoinablePath` for use in tests.
barneygale added a commit to barneygale/cpython that referenced this issue Mar 9, 2025
Test Posix-flavoured `pathlib.types._JoinablePath` in a dedicated test
module. These tests cover `LexicalPosixPath`, `PurePosixPath` and
`PosixPath`, where `LexicalPosixPath` is a simple implementation of
`_JoinablePath` for use in tests.
barneygale added a commit to barneygale/cpython that referenced this issue Mar 9, 2025
Test `pathlib.types._ReadablePath` in a dedicated test module. These tests
cover `ReadableZipPath`, `ReadableLocalPath` and `Path`, where the former
two classes are implementations of `_ReadablePath` for use in tests.
@picnixz picnixz added the type-feature A feature request or enhancement label Mar 9, 2025
barneygale added a commit to barneygale/cpython that referenced this issue Mar 10, 2025
barneygale added a commit that referenced this issue Mar 10, 2025
…31017)

Test Posix-flavoured `pathlib.types._JoinablePath` in a dedicated test
module. These tests cover `LexicalPosixPath`, `PurePosixPath` and
`PosixPath`, where `LexicalPosixPath` is a simple implementation of
`_JoinablePath` for use in tests.
barneygale added a commit to barneygale/cpython that referenced this issue Mar 10, 2025
barneygale added a commit that referenced this issue Mar 11, 2025
…131016)

Test Windows-flavoured `pathlib.types._JoinablePath` in a dedicated test
module. These tests cover `LexicalWindowsPath`, `PureWindowsPath` and
`WindowsPath`, where `LexicalWindowsPath` is a simple implementation of
`_JoinablePath` for use in tests.
barneygale added a commit to barneygale/cpython that referenced this issue Mar 11, 2025
barneygale added a commit that referenced this issue Mar 11, 2025
Test `pathlib.types._ReadablePath` in a dedicated test module. These tests
cover `ReadableZipPath`, `ReadableLocalPath` and `Path`, where the former
two classes are implementations of `_ReadablePath` for use in tests.
barneygale added a commit to barneygale/cpython that referenced this issue Mar 11, 2025
Test `pathlib.types._WritablePath` in a dedicated test module. These tests
cover `WritableZipPath`, `WritableLocalPath` and `Path`, where the former
two classes are implementations of `_WritablePath` for use in tests.
barneygale added a commit that referenced this issue Mar 12, 2025
Test `pathlib.types._WritablePath` in a dedicated test module. These tests
cover `WritableZipPath`, `WritableLocalPath` and `Path`, where the former
two classes are implementations of `_WritablePath` for use in tests.
barneygale added a commit to barneygale/cpython that referenced this issue Mar 12, 2025
Test copying from `Path` and `ReadableZipPath` (types of `_ReadablePath`)
to `Path` and `WritableZipPath` (types of `_WritablePath`).
barneygale added a commit to barneygale/cpython that referenced this issue Mar 13, 2025
barneygale added a commit that referenced this issue Mar 13, 2025
…1168)

Test copying from `Path` and `ReadableZipPath` (types of `_ReadablePath`)
to `Path` and `WritableZipPath` (types of `_WritablePath`).
barneygale added a commit to barneygale/cpython that referenced this issue Mar 13, 2025
…dule

Remove the `test.test_pathlib.test_pathlib_abc` test module, which was
hollowed out in previous commits. Its few remaining tests are most relevant
to `PurePath` and `Path`, so we move them into `test_pathlib`.
barneygale added a commit to barneygale/cpython that referenced this issue Mar 14, 2025
…adata

In the private pathlib ABCs, replace `_WritablePath._write_info()` with
`_WritablePath._copy_from()`. This provides the target path object with
more control over the copying process, including support for querying and
setting metadata *before* the path is created.

Adjust `_ReadablePath.copy()` so that it forwards its keyword arguments to
`_WritablePath._copy_from()` of the target path object. This allows us to
remove the unimplemented *preserve_metadata* argument in the ABC method,
making it a `Path` exclusive.
barneygale added a commit that referenced this issue Mar 14, 2025
…131215)

Remove the `test.test_pathlib.test_pathlib_abc` test module, which was
hollowed out in previous commits. Its few remaining tests are most relevant
to `PurePath` and `Path`, so we move them into `test_pathlib`.
barneygale added a commit that referenced this issue Mar 16, 2025
…131259)

In the private pathlib ABCs, replace `_WritablePath._write_info()` with
`_WritablePath._copy_from()`. This provides the target path object with
more control over the copying process, including support for querying and
setting metadata *before* the path is created.

Adjust `_ReadablePath.copy()` so that it forwards its keyword arguments to
`_WritablePath._copy_from()` of the target path object. This allows us to
remove the unimplemented *preserve_metadata* argument in the ABC method,
making it a `Path` exclusive.
plashchynski pushed a commit to plashchynski/cpython that referenced this issue Mar 17, 2025
…ython#131112)

Test `pathlib.types._WritablePath` in a dedicated test module. These tests
cover `WritableZipPath`, `WritableLocalPath` and `Path`, where the former
two classes are implementations of `_WritablePath` for use in tests.
plashchynski pushed a commit to plashchynski/cpython that referenced this issue Mar 17, 2025
python#131168)

Test copying from `Path` and `ReadableZipPath` (types of `_ReadablePath`)
to `Path` and `WritableZipPath` (types of `_WritablePath`).
plashchynski pushed a commit to plashchynski/cpython that referenced this issue Mar 17, 2025
…dule (python#131215)

Remove the `test.test_pathlib.test_pathlib_abc` test module, which was
hollowed out in previous commits. Its few remaining tests are most relevant
to `PurePath` and `Path`, so we move them into `test_pathlib`.
plashchynski pushed a commit to plashchynski/cpython that referenced this issue Mar 17, 2025
…adata (python#131259)

In the private pathlib ABCs, replace `_WritablePath._write_info()` with
`_WritablePath._copy_from()`. This provides the target path object with
more control over the copying process, including support for querying and
setting metadata *before* the path is created.

Adjust `_ReadablePath.copy()` so that it forwards its keyword arguments to
`_WritablePath._copy_from()` of the target path object. This allows us to
remove the unimplemented *preserve_metadata* argument in the ABC method,
making it a `Path` exclusive.
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
…e()` (python#130990)

In `pathlib.types._JoinablePath.with_name()`, retain any alternative path
separator preceding the old name, rather stripping and replacing it with a
primary separator. As a result, this method changes _only_ the name.
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
…atch()` (python#130991)

In `pathlib.types._JoinablePath.full_match()`, treat alternate path
separators in the path and pattern as if they were primary separators. e.g.
if the parser is `ntpath`, then `P(r'foo/bar\baz').full_match(r'*\*/*')` is
true.
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
…thon#130988)

Test `pathlib.types._JoinablePath` in a dedicated test module. These tests
cover `LexicalPath`, `PurePath` and `Path`, where `LexicalPath` is defined
in a new `test.test_pathlib.support` package.
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
…ng (python#131017)

Test Posix-flavoured `pathlib.types._JoinablePath` in a dedicated test
module. These tests cover `LexicalPosixPath`, `PurePosixPath` and
`PosixPath`, where `LexicalPosixPath` is a simple implementation of
`_JoinablePath` for use in tests.
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
…ning (python#131016)

Test Windows-flavoured `pathlib.types._JoinablePath` in a dedicated test
module. These tests cover `LexicalWindowsPath`, `PureWindowsPath` and
`WindowsPath`, where `LexicalWindowsPath` is a simple implementation of
`_JoinablePath` for use in tests.
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
…ython#131018)

Test `pathlib.types._ReadablePath` in a dedicated test module. These tests
cover `ReadableZipPath`, `ReadableLocalPath` and `Path`, where the former
two classes are implementations of `_ReadablePath` for use in tests.
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
…ython#131112)

Test `pathlib.types._WritablePath` in a dedicated test module. These tests
cover `WritableZipPath`, `WritableLocalPath` and `Path`, where the former
two classes are implementations of `_WritablePath` for use in tests.
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
python#131168)

Test copying from `Path` and `ReadableZipPath` (types of `_ReadablePath`)
to `Path` and `WritableZipPath` (types of `_WritablePath`).
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
…dule (python#131215)

Remove the `test.test_pathlib.test_pathlib_abc` test module, which was
hollowed out in previous commits. Its few remaining tests are most relevant
to `PurePath` and `Path`, so we move them into `test_pathlib`.
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
…adata (python#131259)

In the private pathlib ABCs, replace `_WritablePath._write_info()` with
`_WritablePath._copy_from()`. This provides the target path object with
more control over the copying process, including support for querying and
setting metadata *before* the path is created.

Adjust `_ReadablePath.copy()` so that it forwards its keyword arguments to
`_WritablePath._copy_from()` of the target path object. This allows us to
remove the unimplemented *preserve_metadata* argument in the ABC method,
making it a `Path` exclusive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir topic-pathlib type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants