-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
capture: recover from closed files #2633
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Please add a new changelog entry and a test
Unfortunately the only place I can reproduce this is on the pyinstaller test suite on py36-win_amd64. For some reason stderr capturing fails resulting in verbose test output and invalid sys.stderr.fileno(). |
I see, thanks. Perhaps you can forcibly close the captured file handle inside a test and ensure it doesn't blow up? |
Took the liberty of refactoring the test into a subtest. 😁 |
@@ -388,17 +396,23 @@ def done(self): | |||
seeked to position zero. """ | |||
targetfd_save = self.__dict__.pop("targetfd_save") | |||
os.dup2(targetfd_save, self.targetfd) | |||
os.close(targetfd_save) | |||
# os.close(targetfd_save) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this code commented out?
@@ -1159,3 +1159,6 @@ def test_pickling_and_unpickling_enocded_file(): | |||
ef = capture.EncodedFile(None, None) | |||
ef_as_str = pickle.dumps(ef) | |||
pickle.loads(ef_as_str) | |||
|
|||
def test_closed_handle(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you overwrote my update to this test, was that deliberate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicoddemus I am sorry about this; I thought that this had already been merged so I could trash the branch.
@nicoddemus I have addressed the root cause of these problems with PyInstaller so I do not think that it is worth the time to try to fix this PR. I am sorry for any wasted time. |
@xoviat OK then, much thanks anyway for the contribution! 👍 |
@xoviat for documentation purposes, can you please link the solution, im curious |
works around pytest-dev/pytest-xdist#167. This is not however a "fix" but simply allows the tests to run.