if support.check_sanitizer(address=True, memory=True):
- # bpo-46633: test___all__ is skipped because importing some modules
- # directly can trigger known problems with ASAN (like tk).
- raise unittest.SkipTest("workaround ASAN build issues on loading tests "
- "like tk")
+ SKIP_MODULES = frozenset((
+ # gh-90791: Tests involving libX11 can SEGFAULT on ASAN/MSAN builds.
+ # Skip modules, packages and tests using '_tkinter'.
+ '_tkinter',
+ 'tkinter',
+ 'test_tkinter',
+ 'test_ttk',
+ 'test_ttk_textonly',
+ 'idlelib',
+ 'test_idle',
+ ))
+else:
+ SKIP_MODULES = ()
class NoAll(RuntimeError):
for fn in sorted(os.listdir(basedir)):
path = os.path.join(basedir, fn)
if os.path.isdir(path):
+ if fn in SKIP_MODULES:
+ continue
pkg_init = os.path.join(path, '__init__.py')
if os.path.exists(pkg_init):
yield pkg_init, modpath + fn
for p, m in self.walk_modules(path, modpath + fn + "."):
yield p, m
continue
- if not fn.endswith('.py') or fn == '__init__.py':
+
+ if fn == '__init__.py':
+ continue
+ if not fn.endswith('.py'):
+ continue
+ modname = fn.removesuffix('.py')
+ if modname in SKIP_MODULES:
continue
- yield path, modpath + fn[:-3]
+ yield path, modpath + modname
def test_all(self):
# List of denied modules and packages
if denied:
continue
if support.verbose:
- print(modname)
+ print(f"Check {modname}", flush=True)
try:
# This heuristic speeds up the process by removing, de facto,
# most test modules (and avoiding the auto-executing ones).
with open(path, "rb") as f:
if b"__all__" not in f.read():
raise NoAll(modname)
- self.check_all(modname)
+ self.check_all(modname)
except NoAll:
ignored.append(modname)
except FailedImport:
from test.support import check_sanitizer
if check_sanitizer(address=True, memory=True):
+ # See gh-90791 for details
raise unittest.SkipTest("Tests involving libX11 can SEGFAULT on ASAN/MSAN builds")
# Skip test_idle if _tkinter, tkinter, or idlelib are missing.