Skip to content

Commit 860b29d

Browse files
switch to FileClient2 and disable monitor tests on Windows
1 parent c97d31d commit 860b29d

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

tests/cmd/file_server.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010
import tempfile
1111
from pathlib import Path
1212
from typing import Tuple, Optional
13+
import pytest
1314
import pycyphal
1415
from pycyphal.transport.udp import UDPTransport
1516
from tests.subprocess import Subprocess
1617

1718

1819
async def _unittest_file_server_pnp() -> None:
1920
from pycyphal.application import make_node, NodeInfo, make_registry
20-
from pycyphal.application.file import FileClient
21+
from pycyphal.application.file import FileClient2
2122
from pycyphal.application.plug_and_play import Allocatee
2223

2324
asyncio.get_running_loop().slow_callback_duration = 10.0
@@ -28,24 +29,15 @@ async def _unittest_file_server_pnp() -> None:
2829
"file-server",
2930
root,
3031
f"--plug-and-play={root}/allocation_table.db",
31-
environment_variables={
32-
"UAVCAN__UDP__IFACE": "127.0.0.1",
33-
"UAVCAN__NODE__ID": "42",
34-
},
32+
environment_variables={"UAVCAN__UDP__IFACE": "127.0.0.1", "UAVCAN__NODE__ID": "42"},
3533
)
3634
cln_node = make_node(
3735
NodeInfo(name="org.opencyphal.yakut.test.file.client"),
38-
make_registry(
39-
None,
40-
{
41-
"UAVCAN__UDP__IFACE": "127.0.0.1",
42-
"UAVCAN__NODE__ID": "43",
43-
},
44-
),
36+
make_registry(None, {"UAVCAN__UDP__IFACE": "127.0.0.1", "UAVCAN__NODE__ID": "43"}),
4537
)
4638
try:
47-
fc = FileClient(cln_node, 42, response_timeout=30.0) # Large timeout is needed for Windows CI.
48-
await asyncio.sleep(3.0) # Let the server initialize.
39+
fc = FileClient2(cln_node, 42, response_timeout=30.0)
40+
await asyncio.sleep(10.0) # Let the server initialize.
4941
assert srv_proc.alive
5042

5143
async def ls(path: str) -> typing.List[str]:
@@ -56,12 +48,13 @@ async def ls(path: str) -> typing.List[str]:
5648

5749
# Check the file server.
5850
assert ["allocation_table.db"] == await ls("/")
59-
assert 0 == await fc.touch("/foo")
51+
await fc.touch("/foo")
6052
assert ["allocation_table.db", "foo"] == await ls("/")
61-
assert 0 == await fc.write("/foo", b"Hello world!")
53+
await fc.write("/foo", b"Hello world!")
6254
assert b"Hello world!" == await fc.read("/foo")
63-
assert 0 == await fc.remove("/foo")
64-
assert 0 != await fc.remove("/foo")
55+
await fc.remove("/foo")
56+
with pytest.raises(pycyphal.application.file.RemoteFileError):
57+
await fc.remove("/foo")
6558
assert ["allocation_table.db"] == await ls("/")
6659

6760
# Check the allocator.

tests/cmd/monitor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
from tests.subprocess import Subprocess
1616
import yakut
1717

18+
if sys.platform.startswith("win"): # pragma: no cover
19+
pytest.skip("These are GNU/Linux-only tests", allow_module_level=True)
20+
1821

1922
# noinspection SpellCheckingInspection
2023
@pytest.mark.asyncio

0 commit comments

Comments
 (0)