From 2c90ac81f53e13736fc0b31b5bc4ec4b9a46b3aa Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 29 Sep 2022 10:03:17 -0400 Subject: [PATCH] Use os.path.isfile for checking if path.is_file, suppresses exceptions. Fixes pypa/distutils#181. --- distutils/dist.py | 2 +- distutils/tests/test_dist.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/distutils/dist.py b/distutils/dist.py index 1dc25fe5..917cd94a 100644 --- a/distutils/dist.py +++ b/distutils/dist.py @@ -334,7 +334,7 @@ def find_config_files(self): - a file named by an environment variable """ check_environ() - files = [str(path) for path in self._gen_paths() if path.is_file()] + files = [str(path) for path in self._gen_paths() if os.path.isfile(path)] if DEBUG: self.announce("using config files: %s" % ', '.join(files)) diff --git a/distutils/tests/test_dist.py b/distutils/tests/test_dist.py index 0f205fe4..e6135dbf 100644 --- a/distutils/tests/test_dist.py +++ b/distutils/tests/test_dist.py @@ -258,7 +258,6 @@ def test_find_config_files_disable(self, temp_home): # make sure --no-user-cfg disables the user cfg file assert len(all_files) - 1 == len(files) - @pytest.mark.xfail(reason="pypa/distutils#181", strict=True) @pytest.mark.skipif( 'platform.system() == "Windows"', 'Windows does not honor chmod 000',