GithubHelp home page GithubHelp logo

Comments (5)

ssbarnea avatar ssbarnea commented on June 15, 2024

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.

sebix avatar sebix commented on June 15, 2024

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.

dvzrv avatar dvzrv commented on June 15, 2024

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.

papoteur-mga avatar papoteur-mga commented on June 15, 2024

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.

ssbarnea avatar ssbarnea commented on June 15, 2024

A PR would be welcomed!

from subprocess-tee.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.