Skip to content

Commit 0b44eb4

Browse files
committed
fix(tests): adapt publisher tests to per-put instrumentation API
1 parent 687532d commit 0b44eb4

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

tests/test_timestamp_stack.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,17 @@ def put(session):
116116

117117

118118
def test_publisher_default():
119-
"""Publisher-level default instrumentation applies to all puts."""
119+
"""Publisher put with instrumentation records SEND and RECEIVE points."""
120120
instr = TimestampInstrumentation(send=True, receive=True)
121121
received: List[zenoh.Sample] = []
122122

123123
with zenoh.open(peer_config()) as session:
124124
with session.declare_subscriber(
125125
"test/ts/pub_default", lambda s: received.append(s)
126126
):
127-
with session.declare_publisher(
128-
"test/ts/pub_default", timestamp_instrumentation=instr
129-
) as pub:
127+
with session.declare_publisher("test/ts/pub_default") as pub:
130128
time.sleep(0.05)
131-
pub.put(b"data")
129+
pub.put(b"data", timestamp_instrumentation=instr)
132130
time.sleep(SLEEP)
133131

134132
assert len(received) == 1
@@ -143,18 +141,15 @@ def test_publisher_default():
143141

144142

145143
def test_publisher_per_put_override():
146-
"""Per-put override takes precedence over publisher default."""
147-
default_instr = TimestampInstrumentation(send=True, receive=True)
144+
"""Per-put instrumentation controls which points are recorded."""
148145
override_instr = TimestampInstrumentation(send=True, receive=False)
149146
received: List[zenoh.Sample] = []
150147

151148
with zenoh.open(peer_config()) as session:
152149
with session.declare_subscriber(
153150
"test/ts/pub_override", lambda s: received.append(s)
154151
):
155-
with session.declare_publisher(
156-
"test/ts/pub_override", timestamp_instrumentation=default_instr
157-
) as pub:
152+
with session.declare_publisher("test/ts/pub_override") as pub:
158153
time.sleep(0.05)
159154
pub.put(b"data", timestamp_instrumentation=override_instr)
160155
time.sleep(SLEEP)

0 commit comments

Comments
 (0)