Skip to content

Conversation

@DMedina559
Copy link
Contributor

@DMedina559 DMedina559 commented Aug 13, 2025

  • Fixed scenarios where stdout/err is redirected to file (TypeError is raised if no stderr is registered, but a file is passed as the stderr argument #144)
  • Handle stdin=subprocess.PIPE
  • Added pytest for both fixes
  • Added .vs/ to .gitignore file for visual studio
  • Ignore PytestDeprecationWarning in pytest.ini.
  • Suppress docutils errors in tests/test_examples.py by setting report_level to 5.
  • Windows specific fixes in test such as converting to lowercase in whoami test and using a more cross-platform generic command in README.rst

Allows tests to write to the standard input of a mocked process
@aklajnert
Copy link
Owner

@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.
@DMedina559 DMedina559 marked this pull request as draft August 20, 2025 13:50
DMedina559 and others added 2 commits August 20, 2025 08:06
* test: convert to lowercase in whoami test

* test: use a more cross platform command

or else you'd get  FileNotFoundError errors
@DMedina559
Copy link
Contributor Author

Ok, I've gotten all 143 test passing on Windows (py3.13) and all 140 test passing on Linux (py3.12)

@DMedina559 DMedina559 marked this pull request as ready for review August 20, 2025 15:26
@aklajnert aklajnert requested a review from Copilot August 21, 2025 07:27
Copy link

Copilot AI left a 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
@DMedina559
Copy link
Contributor Author

All test on all platforms now pass

@aklajnert aklajnert merged commit 153a413 into aklajnert:master Aug 25, 2025
25 checks passed
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