Skip to content

Wrap file created by mkstemp #66

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

Merged
merged 1 commit into from
Jan 14, 2016

Conversation

dougluce
Copy link
Contributor

This promotes the FakeFileWrapper class to top-level and has mkstemp wrap its file. This lets fdopen() work properly. This should address #23 (among other things).

This promotes the FakeFileWrapper class to top-level and has mkstemp
wrap its file.  This lets fdopen() work properly.
@jmcgeheeiv
Copy link
Contributor

Thank you for this fix. Could I ask you to address these?

@dougluce
Copy link
Contributor Author

I don't think FakeFileWrapper can be returned to its original place as it was promoted and unnested from FakeFileOpen. If it helps, this is the diff of the other changes to that class:

12c12
<   def __init__(self, file_object, update=False, read=False, append=False,
---
>   def __init__(self, file_object, file_path, update=False, read=False, append=False,
15a16
>     self._file_path = file_path
196c197
<       raise FakeLargeFileIoException(file_path)
---
>       raise FakeLargeFileIoException(self._file_path)

I extended the testMkstemp test in fake_tempfile_test.py to cover this case, adapted from the description on #23. This test fails on 37fb868 (as is proper).

jmcgeheeiv added a commit that referenced this pull request Jan 14, 2016
@jmcgeheeiv jmcgeheeiv merged commit f9b1be2 into pytest-dev:master Jan 14, 2016
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