Skip to content

capture: recover from closed files - #2633

Closed
ghost wants to merge 6 commits into
masterfrom
unknown repository
Closed

ghost wants to merge 6 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Jul 30, 2017

Copy link
Copy Markdown

works around pytest-dev/pytest-xdist#167. This is not however a "fix" but simply allows the tests to run.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.07%) to 91.992% when pulling 36d1d8c on xoviat:capture into 5e0e038 on pytest-dev:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.06%) to 91.995% when pulling d0a032e on xoviat:capture into 5e0e038 on pytest-dev:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.08%) to 91.975% when pulling bbab72b on xoviat:capture into 5e0e038 on pytest-dev:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.1%) to 91.962% when pulling c007b2b on xoviat:capture into 5e0e038 on pytest-dev:master.

@nicoddemus nicoddemus left a comment

Copy link
Copy Markdown
Member

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

@ghost

ghost commented Jul 30, 2017

Copy link
Copy Markdown
Author

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().

@nicoddemus

Copy link
Copy Markdown
Member

I see, thanks.

Perhaps you can forcibly close the captured file handle inside a test and ensure it doesn't blow up?

@nicoddemus

Copy link
Copy Markdown
Member

Took the liberty of refactoring the test into a subtest. 😁

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.1%) to 91.963% when pulling e8ef67a on xoviat:capture into 5e0e038 on pytest-dev:master.

Comment thread _pytest/capture.py
targetfd_save = self.__dict__.pop("targetfd_save")
os.dup2(targetfd_save, self.targetfd)
os.close(targetfd_save)
# os.close(targetfd_save)

Copy link
Copy Markdown
Member

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?

Comment thread testing/test_capture.py
ef_as_str = pickle.dumps(ef)
pickle.loads(ef_as_str)

def test_closed_handle():

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Author

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.

@ghost

ghost commented Jul 31, 2017

Copy link
Copy Markdown
Author

@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.

@ghost ghost closed this Jul 31, 2017
@ghost
ghost deleted the capture branch July 31, 2017 19:43
@nicoddemus

Copy link
Copy Markdown
Member

@xoviat OK then, much thanks anyway for the contribution! 👍

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

@xoviat for documentation purposes, can you please link the solution, im curious

@ghost

ghost commented Aug 1, 2017

Copy link
Copy Markdown
Author

See here: https://github.com/pyinstaller/pyinstaller/pull/2713/files#diff-f1efaa62975ecd8783846ec9799512a7R348

This pull request was closed.
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.

4 participants