-
Notifications
You must be signed in to change notification settings - Fork 18
fix: handle file stdout/stderr #186
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
Allows tests to write to the standard input of a mocked process
|
@DMedina559 thank you for your contribution, but please fix the tests. |
- ignore `PytestDeprecationWarning` in `pytest.ini`. - suppress `docutils` errors in `tests/test_examples.py` by setting `report_level` to 5.
test: fix failing test
* test: convert to lowercase in whoami test * test: use a more cross platform command or else you'd get FileNotFoundError errors
for more information, see https://pre-commit.ci
|
Ok, I've gotten all 143 test passing on Windows (py3.13) and all 140 test passing on Linux (py3.12) |
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.
Pull Request Overview
This PR fixes several issues with subprocess handling and improves cross-platform compatibility. The main purpose is to resolve a bug where stdout/stderr redirection to files caused TypeErrors and to enhance stdin handling with subprocess.PIPE.
- Fixed TypeError when stdout/stderr is redirected to files and streams are not registered
- Added support for stdin=subprocess.PIPE to provide a writable buffer
- Improved cross-platform compatibility in tests and documentation
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_subprocess.py | Added tests for stdin pipe handling and stdout/stderr file redirection fixes, plus Windows compatibility improvements |
| tests/test_examples.py | Suppressed docutils error reporting by setting report_level to 5 |
| pytest_subprocess/fake_popen.py | Implemented stdin pipe support and fixed None data handling in buffer writes |
| pytest.ini | Added asyncio configuration and ignored pytest deprecation warnings |
| README.rst | Updated examples to use more cross-platform commands instead of Unix-specific 'ls' |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
* temp: test on push * fix: increase timeout for mac test * fix: ignore warning in universal newlines test * fix: add another filterwarning tag * remove: temp on push test
|
All test on all platforms now pass |
stdin=subprocess.PIPE.vs/to.gitignorefile for visual studioPytestDeprecationWarninginpytest.ini.docutilserrors intests/test_examples.pyby settingreport_levelto 5.whoamitest and using a more cross-platform generic command in README.rst