From 2e4f73760dcbf1fb15bea4c6a89e4a65012ef74d Mon Sep 17 00:00:00 2001 From: Arthur Zamarin Date: Fri, 23 Dec 2022 23:37:47 +0200 Subject: remove osutils.native_readdir.listdir Signed-off-by: Arthur Zamarin --- src/snakeoil/osutils/__init__.py | 2 +- src/snakeoil/osutils/native_readdir.py | 2 -- tests/test_osutils.py | 8 +------- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/snakeoil/osutils/__init__.py b/src/snakeoil/osutils/__init__.py index 036a78d..1910859 100644 --- a/src/snakeoil/osutils/__init__.py +++ b/src/snakeoil/osutils/__init__.py @@ -59,7 +59,7 @@ from . import native_readdir as module # force utf8 codepaths yet. from ..klass import steal_docs -listdir = module.listdir +listdir = os.listdir listdir_dirs = module.listdir_dirs listdir_files = module.listdir_files readdir = module.readdir diff --git a/src/snakeoil/osutils/native_readdir.py b/src/snakeoil/osutils/native_readdir.py index b129a9b..d7c2fd9 100644 --- a/src/snakeoil/osutils/native_readdir.py +++ b/src/snakeoil/osutils/native_readdir.py @@ -18,8 +18,6 @@ from stat import ( from ..mappings import ProtectedDict -listdir = os.listdir - # we can still use the cpy pjoin here, just need to do something about the # import cycle. pjoin = os.path.join diff --git a/tests/test_osutils.py b/tests/test_osutils.py index 264d670..fac9853 100644 --- a/tests/test_osutils.py +++ b/tests/test_osutils.py @@ -18,8 +18,7 @@ from snakeoil.osutils.mount import MNT_DETACH, MS_BIND, mount, umount class ReaddirCommon: @pytest.fixture def subdir(self, tmp_path): - subdir = tmp_path / "dir" - subdir.mkdir() + (subdir := tmp_path / "dir").mkdir() (tmp_path / "file").touch() os.mkfifo((tmp_path / "fifo")) return subdir @@ -30,10 +29,6 @@ class ReaddirCommon: class TestNativeListDir(ReaddirCommon): - def test_listdir(self, tmp_path, subdir): - assert set(native_readdir.listdir(tmp_path)) == {"dir", "fifo", "file"} - assert native_readdir.listdir(subdir) == [] - def test_listdir_dirs(self, tmp_path, subdir): assert native_readdir.listdir_dirs(tmp_path) == ["dir"] assert native_readdir.listdir_dirs(subdir) == [] @@ -46,7 +41,6 @@ class TestNativeListDir(ReaddirCommon): return self._test_missing( tmp_path, ( - native_readdir.listdir, native_readdir.listdir_dirs, native_readdir.listdir_files, ), -- cgit v1.2.3-65-gdbad