forked from eclipse-ecal/rosidl_typesupport_protobuf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test for rosidl_adapter_proto cli
Signed-off-by: Gonzalo de Pedro <[email protected]>
- Loading branch information
1 parent
622c671
commit 8d31a11
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import pytest | ||
import os | ||
import pathlib | ||
import shutil | ||
import subprocess | ||
|
||
from ament_index_python import get_package_share_directory | ||
|
||
def test_ts_files_generation(): | ||
build_then_install('/tmp/tr') | ||
files_exists('/tmp/tr') | ||
|
||
def build_then_install(output_path): | ||
if os.path.exists(output_path): | ||
shutil.rmtree(output_path) | ||
os.makedirs(output_path) | ||
|
||
package_share_path = pathlib.Path( | ||
get_package_share_directory('std_msgs')) | ||
|
||
subprocess.run([ | ||
'rosidl', 'translate', '-o', output_path, '--from', 'msg', '--to', 'proto', 'std_msgs', './msg/String.msg' | ||
], cwd=package_share_path, check=True) | ||
|
||
def files_exists(output_path): | ||
assert pathlib.Path('/tmp/tr/msg/String.pb.cc').exists() | ||
assert pathlib.Path('/tmp/tr/msg/String.pb.h').exists() | ||
assert pathlib.Path('/tmp/tr/msg/String.proto').exists() | ||
assert pathlib.Path('/tmp/tr/tmp/msg/String.idl').exists() | ||
|