fix: a cited module may be a package

python -m runs a package by its __main__.py: scripts.scraper.romfolders is one.
This commit is contained in:
Abdessamad Derraz committed 2026-11-04 05:51:40 +01:00
1 parent 8848f3e6f6
commit fa9fbbed9e
1 file changed
+3 -1
+3 -1
View File
@@ -1270,7 +1270,9 @@ class CitedScriptsExist(unittest.TestCase):
found = []
for number, target, module, _args in _commands(text):
path = ROOT / (target.replace(".", "/") + ".py" if module else target)
if not path.is_file():
# `python -m` also runs a package by its __main__.py.
package = ROOT / target.replace(".", "/") / "__main__.py" if module else None
if not path.is_file() and not (package and package.is_file()):
found.append(f"{number}: {target}")
found += [
f"{number}: {name}"