ros2 / ros2/launch

[launch_pytest]: Output buffered in fixture.

Open
#683 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog
Dominant language
Python
Stars
155
Forks
182
Avg merge
2d 14h
Merged PRs (30d)
6

Description

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04
  • Installation type:
    • Docker
  • Version or commit hash:
    • ros:rolling-ros-core-jammy
  • Client library (if applicable):
    • launch_pytest
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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the launch_pytest fixture behavior with pytest -s and the provided FastapiClient example. Trace how launch output is handled during fixture setup, and consider the issue done when process and launch logs appear while the fixture is waiting rather than only after test_fastapi_client starts.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.