util/jsoncomm: support PathLike
Add support for `util.types.PathLike` paths for socket addresses, instead of just plain strings. Test it by using pathlib.Path to create the address in the corresponding test.
This commit is contained in:
parent
0aa44c23bb
commit
28947f3bae
2 changed files with 7 additions and 5 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
import asyncio
|
||||
import os
|
||||
import pathlib
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
|
|
@ -13,7 +14,7 @@ from osbuild.util import jsoncomm
|
|||
class TestUtilJsonComm(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.dir = tempfile.TemporaryDirectory()
|
||||
self.address = os.path.join(self.dir.name, "listener")
|
||||
self.address = pathlib.Path(self.dir.name, "listener")
|
||||
self.server = jsoncomm.Socket.new_server(self.address)
|
||||
self.client = jsoncomm.Socket.new_client(self.address)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue