Skip to content

Commit 835da5b

Browse files
committed
bbug
1 parent 721bc0b commit 835da5b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/test_executable.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from pathlib import Path
66

77
import pytest
8-
from setuptools.dist import Distribution
98

109
import s5cmd
1110

@@ -28,15 +27,20 @@ def test_module(tool):
2827

2928

3029
def _get_scripts():
31-
dist = Distribution("s5cmd")
30+
# Collect all "scripts" directories from sysconfig schemes
3231
scripts_paths = [
3332
Path(sysconfig.get_path("scripts", scheme)).resolve()
3433
for scheme in sysconfig.get_scheme_names()
3534
]
3635
scripts = []
37-
for file in dist.files:
38-
if file.locate().parent.resolve(strict=True) in scripts_paths:
39-
scripts.append(file.locate().resolve(strict=True))
36+
for scripts_dir in scripts_paths:
37+
# Skip non-existent dirs to avoid Resolve errors
38+
if not scripts_dir.exists():
39+
continue
40+
# Add regular files in the scripts dir (resolve to absolute Path)
41+
for f in scripts_dir.iterdir():
42+
if f.is_file():
43+
scripts.append(f.resolve())
4044
return scripts
4145

4246

0 commit comments

Comments
 (0)