Skip to content

Commit 720d578

Browse files
authored
chore: add test to ensure start cannot happen twice (#3)
1 parent 550307f commit 720d578

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_impl.py

+13
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,16 @@ def broken_callback() -> None:
7878
stop()
7979
await asyncio.sleep(_INOTIFY_WAIT_TIME)
8080
assert not called
81+
82+
83+
@pytest.mark.asyncio
84+
@pytest.mark.skipif(
85+
platform != "linux", reason="Inotify not available on this platform"
86+
)
87+
async def test_aiousbwatcher_attempt_to_start_twice(tmp_path: Path) -> None:
88+
with patch("aiousbwatcher.impl._PATH", str(tmp_path)):
89+
watcher = AIOUSBWatcher()
90+
stop = watcher.async_start()
91+
with pytest.raises(RuntimeError):
92+
watcher.async_start()
93+
stop()

0 commit comments

Comments
 (0)