You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have any launch-related runtime error in your launch_pytest.fixture. If any test uses this fixture, it will get stuck because the fixture fails and the test never starts. If you run pytest verbosely with -s, it will print the error from the fixture and then run indefinitely.
Example code that will cause this indefinite running:
import launch_pytest
import pytest
import rclpy.node
from ament_index_python.packages import get_package_share_directory
from launch.actions import IncludeLaunchDescription
from launch.launch_description import LaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import PathJoinSubstitution
# A launch fixture with an error (can be any error that happens at runtime on the LaunchDescription level)
# (not a Python error)
# (In this case we use a launch file path that does not exist)
@launch_pytest.fixture
def launch_description() -> LaunchDescription:
package_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
PathJoinSubstitution(
[
get_package_share_directory("package_name"),
"thisIsAWrongPathThatWillLeadToNoSuchFileAndThrowAnError",
"package.launch.py",
]
)
)
)
return LaunchDescription(
[
package_launch,
launch_pytest.actions.ReadyToTest(),
]
)
# test that uses the failing fixture
@pytest.mark.launch(fixture=launch_description)
def test_anything() -> None:
rclpy.init()
try:
# does not matter what we do here, the test will get stuck setting up the fixture before this
assert True
finally:
rclpy.shutdown()
Expected behavior
Error from fixture setup leads to test failing.
Actual behavior
Fixture error is printed, when pytest is run with -s, but the test keeps running indefinitely, unless terminated from the outside by an interrupt or by using an external tool like pytest-timeout.
The text was updated successfully, but these errors were encountered:
Did you find a solution? I am having the same problem. I have a fixture which launches a Node which then crashes. When the Node crashes the Testcase just hangs indefinitely. The README says that Test can fail if a Node dies unexpectedly, is there an argument that needs to be passed to enable this behaviour?
Bug report
Required Info:
apt-get install ros-humble-launch-pytest
)Steps to reproduce issue
Have any launch-related runtime error in your launch_pytest.fixture. If any test uses this fixture, it will get stuck because the fixture fails and the test never starts. If you run pytest verbosely with
-s
, it will print the error from the fixture and then run indefinitely.Example code that will cause this indefinite running:
Expected behavior
Error from fixture setup leads to test failing.
Actual behavior
Fixture error is printed, when pytest is run with
-s
, but the test keeps running indefinitely, unless terminated from the outside by an interrupt or by using an external tool likepytest-timeout
.The text was updated successfully, but these errors were encountered: