Comments (5)
That is probably because you do not have PYTHONUNBUFFERED=1
, which is kinda needed for ensuring the order of stdout/stderr. It is not required for using the library but to get the tests passing with expected order it is needed.
from subprocess-tee.
Unfortunately that doesn't fix the failure:
> PYTHONUNBUFFERED=1 pytest -k 'test_rich_console_ex'
============================================================================================================ test session starts ============================================================================================================
platform linux -- Python 3.10.6, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/abuild/rpmbuild/BUILD/subprocess-tee-0.3.5, configfile: setup.cfg, testpaths: src
collected 16 items / 14 deselected / 2 selected
src/subprocess_tee/test/test_rich.py F. [100%]
================================================================================================================= FAILURES ==================================================================================================================
___________________________________________________________________________________________________________ test_rich_console_ex ____________________________________________________________________________________________________________
def test_rich_console_ex() -> None:
"""Validate that ConsoleEx can capture output from print() calls."""
console = Console(record=True, redirect=True)
console.print("alpha")
print("beta")
sys.stdout.write("gamma\n")
sys.stderr.write("delta\n")
# While not supposed to happen we want to be sure that this will not raise
# an exception. Some libraries may still sometimes send bytes to the
# streams, notable example being click.
# sys.stdout.write(b"epsilon\n") # type: ignore
proc = run("echo 123")
assert proc.stdout == "123\n"
text = console.export_text()
> assert text == "alpha\nbeta\ngamma\ndelta\n123\n"
E AssertionError: assert 'alpha\nbeta\...a\n123\n123\n' == 'alpha\nbeta\...ndelta\n123\n'
E alpha
E beta
E + beta
E + gamma
E gamma
E delta
E + delta...
E
E ...Full output truncated (3 lines hidden), use '-vv' to show
src/subprocess_tee/test/test_rich.py:23: AssertionError
----------------------------------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------------------------------
from subprocess-tee.
I'm seeing the same issue on Arch Linux and exporting PYTHONUNBUFFERED=1
also did not fix this for me.
python-subprocess-tee-0.3.5-4-x86_64-build.log
python-subprocess-tee-0.3.5-4-x86_64-check.log
from subprocess-tee.
Hello,
I have the same on Mageia cauldron.
http://pkgsubmit.mageia.org/autobuild/cauldron/x86_64/core/2022-10-31/python-subprocess-tee-0.3.5-1.mga9.src.rpm/build.x86_64.0.20221031145549.log
from subprocess-tee.
A PR would be welcomed!
from subprocess-tee.
Related Issues (20)
- Execution is always as a shell HOT 2
- (🐞) Doesn't work on Windows
- (‼) subprocess-tee is not a drop-in replacement for subprocess
- (🐞) There are no types for the kwargs
- (🐞) Doesn't work from async code
- If check=False execution becomes async
- If check=True, empty output becomes None
- Allow redirecting stderr to stdout (stderr=sp.STDOUT)
- Windows: Multiple arguments unsupported
- Windows: Argument list converted to string incorrectly
- Does not print partial lines
- not working on windows HOT 1
- How do you use this for try-catch exceptions?
- Difference between this and `ubelt.cmd`, others? What makes this problem so difficult? HOT 3
- Not work on windows HOT 1
- Tests are installed
- Platform requirements not clearly advertised HOT 2
- RuntimeError: There is no current event loop in thread 'MainThread'. HOT 2
- Run inside Jupyter HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from subprocess-tee.