|
14 | 14 |
|
15 | 15 | import pathlib |
16 | 16 |
|
| 17 | +from ament_index_python import get_resources |
17 | 18 | from rosidl_cli.command.generate.api import generate |
18 | 19 |
|
19 | 20 | PACKAGE_DIR = str(pathlib.Path(__file__).parent.parent) |
20 | 21 |
|
21 | 22 |
|
22 | | -def test_cli_extension_for_smoke(tmp_path): |
23 | | - generate( |
24 | | - package_name='rosidl_generator_py', |
25 | | - interface_files=[PACKAGE_DIR + ':msg/StringArrays.msg'], |
26 | | - types=['py'], |
27 | | - output_path=tmp_path |
28 | | - ) |
| 23 | +def test_cli_extension_for_smoke(tmp_path, capsys): |
| 24 | + # NOTE(hidmic): pytest and empy do not play along, |
| 25 | + # the latter expects some proxy will stay in sys.stdout |
| 26 | + # and the former insists in overwriting it |
| 27 | + interface_files = [PACKAGE_DIR + ':msg/StringArrays.msg'] |
| 28 | + |
| 29 | + with capsys.disabled(): # so do everything in one run |
| 30 | + # Passing target typesupport implementations explictly |
| 31 | + generate( |
| 32 | + package_name='rosidl_typesupport_py', |
| 33 | + interface_files=interface_files, |
| 34 | + types=['py[typesupport_implementations:{}]'.format( |
| 35 | + list(get_resources('rosidl_typesupport_c')) |
| 36 | + )], |
| 37 | + output_path=tmp_path / 'explicit_args' |
| 38 | + ) |
| 39 | + |
| 40 | + # Using default typesupport implementations |
| 41 | + generate( |
| 42 | + package_name='rosidl_typesupport_pu', |
| 43 | + interface_files=interface_files, |
| 44 | + types=['py'], |
| 45 | + output_path=tmp_path / 'defaults' |
| 46 | + ) |
0 commit comments