Running the test suite fails on Windows 10 or 11 (German locale). The failure is only obvious when running pytest directly.
It does not matter if it is run in powershell, cmd or cmder. The crash always happens in the test test_capture_function_and_subprocess_output object address
.
The same test fails when the test are run in bash shell from git for windows. However, it fails with an assertion error.
C:\Users\david\MyProg\gh-dalito\failprint (main -> origin)
(failprint) λ duty test
> Running tests
C:\Users\david\MyProg\gh-dalito\failprint (main -> origin)
(failprint) λ echo %errorlevel%
0
C:\Users\david\MyProg\gh-dalito\failprint (main -> origin)
(failprint) λ py -m pytest -v
================================================= test session starts =================================================
platform win32 -- Python 3.12.7, pytest-8.3.4, pluggy-1.5.0 -- C:\Users\david\MyProg\gh-dalito\failprint\.venv\Scripts\python.exe
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase(WindowsPath('C:/Users/david/MyProg/gh-dalito/failprint/.hypothesis/examples'))
Using --randomly-seed=2862494129
rootdir: C:\Users\david\MyProg\gh-dalito\failprint
configfile: pyproject.toml
plugins: hypothesis-6.123.1, cov-6.0.0, randomly-3.16.0, timeout-2.3.1, xdist-3.6.1
collected 78 items
tests/test_runners.py::test_process_capture_none PASSED [ 1%]
tests/test_runners.py::test_return_failure_code PASSED [ 2%]
tests/test_runners.py::test_fails_with_falsy_object PASSED [ 3%]
tests/test_runners.py::test_capture_function_and_subprocess_output object address : 0000018201AF4C10
object refcount : 5
object type : 00007FFC9A44E2B0
object type name: OSError
object repr : OSError(9, 'Das Handle ist ung├╝ltig', None, 6, None)
lost sys.stderr
C:\Users\david\MyProg\gh-dalito\failprint (main -> origin)
(failprint) λ failprint --version
failprint 1.0.4.dev2+g807a234
The assertion error from the bash shell (probably unrelated):
david@acompc-ws MINGW64 ~/MyProg/gh-dalito/failprint (main)
$ py -m pytest -v
============================= test session starts =============================
platform win32 -- Python 3.12.7, pytest-8.3.4, pluggy-1.5.0 -- C:\Users\david\MyProg\gh-dalito\failprint\.venv\Scripts\python.exe
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase(WindowsPath('C:/Users/david/MyProg/gh-dalito/failprint/.hypothesis/examples'))
Using --randomly-seed=3183279503
rootdir: C:\Users\david\MyProg\gh-dalito\failprint
configfile: pyproject.toml
plugins: hypothesis-6.123.1, cov-6.0.0, randomly-3.16.0, timeout-2.3.1, xdist-3.6.1
collecting ... collected 78 items
tests/test_formats.py::test_printable_command_with_callable[printable_command-args8-kwargs8-printable_command(Repr(value=0), repr=Repr(value='marvin'))] PASSED [ 1%]
(...)
tests/test_runners.py::test_capture_function_and_subprocess_output FAILED [ 64%]
(...)
tests/test_lazy.py::test_decorating_function PASSED [100%]
================================== FAILURES ===================================
_________________ test_capture_function_and_subprocess_output _________________
capsys = <_pytest.capture.CaptureFixture object at 0x000002A155EE1C70>
def test_capture_function_and_subprocess_output(capsys: pytest.CaptureFixture) -> None:
"""Assert we capture everything when running a function.
Arguments:
capsys: Pytest fixture to capture output.
"""
def function() -> None:
print("print")
sys.stdout.write("sys stdout write\n")
os.system("echo os system") # noqa: S605,S607
subprocess.run(["sh", "-c", "echo sh -c echo"], check=False) # noqa: S603,S607
with capsys.disabled(), Capture.BOTH.here() as captured:
function()
lines = str(captured).rstrip("\n").split("\n")
> assert lines == ["print", "sys stdout write", "os system", "sh -c echo"]
E AssertionError: assert ['os system',...stdout write'] == ['print', 'sy... 'sh -c echo']
E
E At index 0 diff: 'os system' != 'print'
E
E Full diff:
E [
E + 'os system',
E + 'sh -c echo',...
E
E ...Full output truncated (5 lines hidden), use '-vv' to show
tests\test_runners.py:369: AssertionError
=========================== short test summary info ===========================
FAILED tests/test_runners.py::test_capture_function_and_subprocess_output - A...
================== 1 failed, 72 passed, 5 skipped in 12.95s ===================
$ failprint --debug-info
- __System__: Windows-10-10.0.19045-SP0
- __Python__: cpython 3.12.7 (C:\Users\david\MyProg\gh-dalito\failprint\.venv\Scripts\python.exe)
- __Environment variables__:
- __Installed packages__:
- `failprint` v1.0.4.dev2+g807a234
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too