Add support for rosbag version 6 metadata
This commit is contained in:
+13
-1
@@ -57,7 +57,7 @@ rosbag2_bagfile_information:
|
||||
|
||||
METADATA_EMPTY = """
|
||||
rosbag2_bagfile_information:
|
||||
version: 4
|
||||
version: 6
|
||||
storage_identifier: sqlite3
|
||||
relative_file_paths:
|
||||
- db.db3
|
||||
@@ -69,6 +69,16 @@ rosbag2_bagfile_information:
|
||||
topics_with_message_count: []
|
||||
compression_format: ""
|
||||
compression_mode: ""
|
||||
files:
|
||||
- duration:
|
||||
nanoseconds: 0
|
||||
message_count: 0
|
||||
path: db.db3
|
||||
starting_time:
|
||||
nanoseconds_since_epoch: 0
|
||||
custom_data:
|
||||
key1: value1
|
||||
key2: value2
|
||||
"""
|
||||
|
||||
|
||||
@@ -146,6 +156,8 @@ def test_empty_bag(tmp_path: Path) -> None:
|
||||
assert reader.end_time == 0
|
||||
assert reader.duration == 0
|
||||
assert not list(reader.messages())
|
||||
assert reader.custom_data['key1'] == 'value1'
|
||||
assert reader.custom_data['key2'] == 'value2'
|
||||
|
||||
|
||||
def test_reader(bag: Path) -> None:
|
||||
|
||||
@@ -59,6 +59,15 @@ def test_writer(tmp_path: Path) -> None:
|
||||
assert (path / 'compress_message.db3').exists()
|
||||
assert size > (path / 'compress_message.db3').stat().st_size
|
||||
|
||||
path = (tmp_path / 'with_custom_data')
|
||||
bag = Writer(path)
|
||||
bag.open()
|
||||
bag.set_custom_data('key1', 'value1')
|
||||
with pytest.raises(WriterError, match='non-string value'):
|
||||
bag.set_custom_data('key1', 42) # type: ignore
|
||||
bag.close()
|
||||
assert b'key1: value1' in (path / 'metadata.yaml').read_bytes()
|
||||
|
||||
|
||||
def test_failure_cases(tmp_path: Path) -> None:
|
||||
"""Test writer failure cases."""
|
||||
|
||||
Reference in New Issue
Block a user