Add helpers to launch_pytest for checking stdout and stderr of launched processes
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách so sánh launch_pytest/test/launch_pytest/examples/pytest_hello_world.py với launch_testing/asserts/assert_output.py và launch_testing/event_handlers/stdout_ready_listener.py. Hãy tìm hiểu cách launch_pytest có thể quan sát stdout và stderr của một tiến trình khi các bài kiểm thử không giữ các process actions, bao gồm cả trường hợp launch lồng nhau của Gazebo. Kết quả hoàn thành cần cung cấp các helper hoặc fixture có tài liệu, cùng với các bài kiểm thử bao quát đầu ra và lỗi dự kiến.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Feature request
Feature description
launch_testing provides several utilities for checking and waiting on process output, e.g.
It would be nice if we had similar facilities with launch_pytest.
We do have an example of checking the output of a process:
but it requires that the test has a reference to the action under test and that they can set the cached_output=True argument:
As a concrete example, I recently wanted to confirm that launching Gazebo Classic from a nested launch description would produce some expected output and no errors, however we don't have access to the process actions. Here's the existing test where are including the Gazebo launch description to test:
I did not find a simple way to check the output in this case, but maybe I've overlooked something.
Ultimately, I was able to write the test I wanted by registering a launch event handler on process IO and storing that in a list that can be checked in the test. Here's a test fixture I wrote that can be used by tests to check output on stderr:
@pytest.fixture()
def launch_capture_io():
class LaunchCaptureIO:
def __init__(self):
self._event = Event()
self.stderr = []
self.action = RegisterEventHandler(OnProcessIO(on_stderr=self._on_stderr))
def _on_stderr(self, io):
self.stderr.append(io.text.decode('utf-8'))
self._event.set()
def wait_for_stderr(self, *, timeout) -> bool:
result = self._event.wait(timeout)
self._event.clear()
return result
return LaunchCaptureIO()
Implementation considerations
Some options that might be worth investigating (I haven't thought too much about them yet):
- It would be nice if we could leverage any existing pytest features for io handling. I tried to use the built-in capsys feature, but I wasn't able to get it to work (I suspect this is due to launch creating child processes).
- Add a fixture like the one I presented above for the Gazebo test case (ie. use launch events to record process io).
- Instrument launch to be more amenable to testing process io. If we could easily identify processes of interest (e.g we have process matchers for events already) and configure them to cache their output from the test (e.g. maybe a launch configuration), then we could add helpers to query process io.
If anyone has other ideas or thoughts, happy to hear them!
- Ngôn ngữ chính
- Python
- Star
- 156
- Fork
- 200
- Merge trung bình
- 2 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 11
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ros2/launch
-
Use a relative target for the `latest` log symlink so it survives different absolute mount paths (host/Docker)Có thể đã có người làm @Old-Ding đã nhận 139 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ros2/launch#978 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add OpaqueFunction to list at docs.ros.orgCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởbug help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ros2/launch#826 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[launch_testing] pytest>8.1 dropped the legacy "path" argument from its internal hooks on humbleCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
ros2/launch#979 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
gke-labs/kube-agents#7441 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
issue: a reply cut off by a dropped model connection loses its text when the chat is reloadedĐang mởbug confirmed issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
open-webui/open-webui#35142 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày