ros2 / launch

Tools for launching multiple processes and for writing tests involving multiple processes.
Apache License 2.0
126 stars 144 forks source link

[launch_pytest]: Output buffered in fixture. #683

Open rshanor opened 1 year ago

rshanor commented 1 year ago

Bug report

Required Info:

Steps to reproduce issue

I run pytest with the -s flag, but output is buffered until the test actually starts to execute.

@pytest.fixture(scope="function")
def client():
    _client = FastapiClient()
    _client.assert_wait_for_services(timeout_sec=120)
    return _client

@pytest.mark.launch(fixture=generate_test_description)
def test_fastapi_client(client):
    assert True

Expected behavior

I expect launch log output to print to screen while my all my processes launch.

Actual behavior

Nothing prints in the terminal until test_fastapi_client actually started. This could be 120 seconds given the _client.assert_wait_for_services line. I simplified this example but its not as easy to move construction into my actual test.

Happy to help contribute if someone with more experience can point me in the right direction.