Commit 26bf7386 authored by Jan-Niklas Burfeind's avatar Jan-Niklas Burfeind Committed by oroulet

fix: Correct the type of shelf files

in internal_server and address_space.
Path.is_file does not consume strings,
as shelf.open does only consume string and not pathlib.Path.
parent cf2bd668
......@@ -707,7 +707,7 @@ class AddressSpace:
Note: Intended for slow devices, such as Raspberry Pi, to greatly improve start up time
"""
with shelve.open(path, 'n', protocol=pickle.HIGHEST_PROTOCOL) as s:
with shelve.open(str(path), 'n', protocol=pickle.HIGHEST_PROTOCOL) as s:
for nodeid, ndata in self._nodes.items():
s[nodeid.to_string()] = ndata
......
......@@ -139,7 +139,7 @@ class InternalServer:
if shelf_file:
is_file = await asyncio.get_running_loop().run_in_executor(
None, Path.is_file, shelf_file
) or await asyncio.get_running_loop().run_in_executor(None, Path.is_file, f'{shelf_file}.db')
) or await asyncio.get_running_loop().run_in_executor(None, Path.is_file, shelf_file / '.db')
if is_file:
# import address space from shelf
await asyncio.get_running_loop().run_in_executor(None, self.aspace.load_aspace_shelf, shelf_file)
......
......@@ -187,9 +187,6 @@ def test_sync_server_get_node(server, idx):
assert vars[0].read_value() == 6.7
@pytest.mark.xfail(
raises=AttributeError, reason="asyncua introduced a regression, likely when we switched to pathlib", strict=True
)
async def test_sync_server_creating_shelf_files_works(tloop: ThreadLoop, tmp_path: Path) -> None:
shelf_file_path: Path = tmp_path / "shelf_file"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment