diff options
-rw-r--r-- | linuxnamespaces/__init__.py | 1 | ||||
-rw-r--r-- | linuxnamespaces/filedescriptor.py | 3 | ||||
-rw-r--r-- | tests/test_simple.py | 20 |
3 files changed, 16 insertions, 8 deletions
diff --git a/linuxnamespaces/__init__.py b/linuxnamespaces/__init__.py index 9332a06..0392276 100644 --- a/linuxnamespaces/__init__.py +++ b/linuxnamespaces/__init__.py @@ -628,6 +628,7 @@ def unshare_user_idmap( unshare(flags) setup_idmaps() + def unshare_user_idmap_nohelper( uid: int, gid: int, flags: CloneFlags = CloneFlags.NEWUSER ) -> None: diff --git a/linuxnamespaces/filedescriptor.py b/linuxnamespaces/filedescriptor.py index ea699c2..f9460bf 100644 --- a/linuxnamespaces/filedescriptor.py +++ b/linuxnamespaces/filedescriptor.py @@ -10,8 +10,7 @@ import typing @typing.runtime_checkable class HasFileno(typing.Protocol): - def fileno(self) -> int: - ... + def fileno(self) -> int: ... FileDescriptorLike = int | HasFileno diff --git a/tests/test_simple.py b/tests/test_simple.py index 07a0740..2b5252f 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -126,9 +126,13 @@ class AsnycioTest(unittest.IsolatedAsyncioTestCase): async def test_copyfd_file_sock(self) -> None: sock1, sock2 = socket.socketpair() - with sock1, sock2, linuxnamespaces.FileDescriptor( - os.open("/etc/passwd", os.O_RDONLY) - ) as rfd: + with ( + sock1, + sock2, + linuxnamespaces.FileDescriptor( + os.open("/etc/passwd", os.O_RDONLY) + ) as rfd, + ): fut = asyncio.ensure_future( linuxnamespaces.async_copyfd(rfd, sock1.fileno(), 999) ) @@ -139,9 +143,13 @@ class AsnycioTest(unittest.IsolatedAsyncioTestCase): async def test_copyfd_file_pipe(self) -> None: rfdp, wfdp = linuxnamespaces.FileDescriptor.pipe(blocking=False) - with rfdp, wfdp, linuxnamespaces.FileDescriptor( - os.open("/etc/passwd", os.O_RDONLY) - ) as rfd: + with ( + rfdp, + wfdp, + linuxnamespaces.FileDescriptor( + os.open("/etc/passwd", os.O_RDONLY) + ) as rfd, + ): fut = asyncio.ensure_future( linuxnamespaces.async_copyfd(rfd, wfdp, 999) ) |