Skip to content

pytester: _makefile: use abs=True when joining paths #6578

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

Closed
wants to merge 1 commit into from

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Jan 26, 2020

Passing in an absolute path should use that, but not join it with the
tmpdir.

TODO:

  • changelog

Passing in an absolute path should use that, but not join it with the
tmpdir.
@blueyed
Copy link
Contributor Author

blueyed commented Jan 26, 2020

I wonder if we should extend/patch py.path.local to use abs=True by default - this is what pathlib does (and is considered to be more sane in general).

@@ -614,7 +614,7 @@ def to_text(s):

ret = None
for basename, value in items:
p = self.tmpdir.join(basename).new(ext=ext)
p = self.tmpdir.join(basename, abs=True).new(ext=ext)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a breaking change that opens up badly made test suites to accidentally writing system wide files

the pathlib behaviour is a security nightmare as is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RonnyPfannschmidt
So what changes do you request then actually?
The use case here is using testdir.makepyfile with an absolute file - do you think this should not be supported then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing the current behavior in #6579.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current behavior fails on Windows:

OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\popen-gw1\test_makefile_joins_absolute_path0\C:'

blueyed added a commit to blueyed/pytest that referenced this pull request Jan 26, 2020
@blueyed blueyed closed this Jan 26, 2020
@blueyed blueyed deleted the pytester-makefile-abs branch January 26, 2020 23:18
blueyed added a commit to blueyed/pytest that referenced this pull request Jan 26, 2020
blueyed added a commit to blueyed/pytest that referenced this pull request Jan 27, 2020
blueyed added a commit to blueyed/pytest that referenced this pull request Jan 28, 2020
This is a sane method to create a set of files, allowing for absolute
paths.

Ref: pytest-dev#6578
Ref: pytest-dev#6579
blueyed added a commit to blueyed/pytest that referenced this pull request Jan 28, 2020
This is a sane method to create a set of files, allowing for absolute
paths.

Ref: pytest-dev#6578
Ref: pytest-dev#6579
blueyed added a commit to blueyed/pytest that referenced this pull request Jan 28, 2020
This is a sane method to create a set of files, allowing for absolute
paths.

Ref: pytest-dev#6578
Ref: pytest-dev#6579
blueyed added a commit to blueyed/pytest that referenced this pull request Jan 28, 2020
This is a sane method to create a set of files, allowing for absolute
paths.

Ref: pytest-dev#6578
Ref: pytest-dev#6579
blueyed added a commit to blueyed/pytest that referenced this pull request Jan 30, 2020
This is a sane method to create a set of files, allowing for absolute
paths.

Ref: pytest-dev#6578
Ref: pytest-dev#6579
blueyed added a commit to blueyed/pytest that referenced this pull request Jan 30, 2020
This is a sane method to create a set of files, allowing for absolute
paths.

Ref: pytest-dev#6578
Ref: pytest-dev#6579
blueyed added a commit to blueyed/pytest that referenced this pull request Mar 13, 2020
This is a sane method to create a set of files, allowing for absolute
paths.

Ref: pytest-dev#6578
Ref: pytest-dev#6579
blueyed added a commit to blueyed/pytest that referenced this pull request Mar 17, 2020
This is a simple, straight-forward method to create a set of files with
different extensions, and handling absolute paths (inside of the
tmpdir).

Ref: pytest-dev#6578
Ref: pytest-dev#6579
blueyed added a commit to blueyed/pytest that referenced this pull request Mar 18, 2020
This is a simple, straight-forward method to create a set of files with
different extensions, and handling absolute paths (inside of the
tmpdir).

Ref: pytest-dev#6578
Ref: pytest-dev#6579
blueyed added a commit to blueyed/pytest that referenced this pull request Mar 18, 2020
This is a simple, straight-forward method to create a set of files with
different extensions, and handling absolute paths (inside of the
tmpdir).

Ref: pytest-dev#6578
Ref: pytest-dev#6579
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants