|
12 | 12 |
|
13 | 13 |
|
14 | 14 | if support.check_sanitizer(address=True, memory=True):
|
15 |
| - # bpo-46633: test___all__ is skipped because importing some modules |
16 |
| - # directly can trigger known problems with ASAN (like tk). |
17 |
| - raise unittest.SkipTest("workaround ASAN build issues on loading tests " |
18 |
| - "like tk") |
| 15 | + SKIP_MODULES = frozenset(( |
| 16 | + # gh-90791: Tests involving libX11 can SEGFAULT on ASAN/MSAN builds. |
| 17 | + # Skip modules, packages and tests using '_tkinter'. |
| 18 | + '_tkinter', |
| 19 | + 'tkinter', |
| 20 | + 'test_tkinter', |
| 21 | + 'test_ttk', |
| 22 | + 'test_ttk_textonly', |
| 23 | + 'idlelib', |
| 24 | + 'test_idle', |
| 25 | + )) |
| 26 | +else: |
| 27 | + SKIP_MODULES = () |
19 | 28 |
|
20 | 29 |
|
21 | 30 | class NoAll(RuntimeError):
|
@@ -83,15 +92,23 @@ def walk_modules(self, basedir, modpath):
|
83 | 92 | for fn in sorted(os.listdir(basedir)):
|
84 | 93 | path = os.path.join(basedir, fn)
|
85 | 94 | if os.path.isdir(path):
|
| 95 | + if fn in SKIP_MODULES: |
| 96 | + continue |
86 | 97 | pkg_init = os.path.join(path, '__init__.py')
|
87 | 98 | if os.path.exists(pkg_init):
|
88 | 99 | yield pkg_init, modpath + fn
|
89 | 100 | for p, m in self.walk_modules(path, modpath + fn + "."):
|
90 | 101 | yield p, m
|
91 | 102 | continue
|
92 |
| - if not fn.endswith('.py') or fn == '__init__.py': |
| 103 | + |
| 104 | + if fn == '__init__.py': |
| 105 | + continue |
| 106 | + if not fn.endswith('.py'): |
| 107 | + continue |
| 108 | + modname = fn.removesuffix('.py') |
| 109 | + if modname in SKIP_MODULES: |
93 | 110 | continue
|
94 |
| - yield path, modpath + fn[:-3] |
| 111 | + yield path, modpath + modname |
95 | 112 |
|
96 | 113 | def test_all(self):
|
97 | 114 | # List of denied modules and packages
|
@@ -119,14 +136,14 @@ def test_all(self):
|
119 | 136 | if denied:
|
120 | 137 | continue
|
121 | 138 | if support.verbose:
|
122 |
| - print(modname) |
| 139 | + print(f"Check {modname}", flush=True) |
123 | 140 | try:
|
124 | 141 | # This heuristic speeds up the process by removing, de facto,
|
125 | 142 | # most test modules (and avoiding the auto-executing ones).
|
126 | 143 | with open(path, "rb") as f:
|
127 | 144 | if b"__all__" not in f.read():
|
128 | 145 | raise NoAll(modname)
|
129 |
| - self.check_all(modname) |
| 146 | + self.check_all(modname) |
130 | 147 | except NoAll:
|
131 | 148 | ignored.append(modname)
|
132 | 149 | except FailedImport:
|
|
0 commit comments