diff -r c35d65c9ded3 Lib/test/test___all__.py --- a/Lib/test/test___all__.py Fri Nov 20 09:24:02 2015 +0100 +++ b/Lib/test/test___all__.py Sun Nov 22 11:48:29 2015 +0100 @@ -1,6 +1,7 @@ import unittest from test import support import os +import re import sys @@ -99,8 +100,9 @@ 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(): + if re.search(br'\b__all__\b', f.read()) is None: raise NoAll(modname) self.check_all(modname) except NoAll: