Skip to content

Commit 6a70ba0

Browse files
committed
Add test.
1 parent 4facf70 commit 6a70ba0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/test_sync.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ def periodicity():
7474
if msg is not None:
7575
self.assertIsNone(self.net.bus.recv(TIMEOUT))
7676

77+
def test_sync_producer_restart(self):
78+
self.sync.start(PERIOD)
79+
self.addCleanup(self.sync.stop)
80+
# Cannot start again while running
81+
with self.assertRaises(RuntimeError):
82+
self.sync.start(PERIOD)
83+
# Can restart after stopping
84+
self.sync.stop()
85+
self.sync.start(PERIOD)
86+
7787

7888
if __name__ == "__main__":
7989
unittest.main()

0 commit comments

Comments
 (0)