Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Unified Diff: expect_tests/main.py

Issue 448013002: Let expect_tests stop walking across certain packages. (Closed) Base URL: https://chromium.googlesource.com/infra/testing/expect_tests.git@master
Patch Set: Reupload Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « expect_tests/__init__.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: expect_tests/main.py
diff --git a/expect_tests/main.py b/expect_tests/main.py
index 238c38c38c9abc6c7989796ec0ce914744818d10..a9400f96e3b1796ec002d03c1511d6024a83c028 100644
--- a/expect_tests/main.py
+++ b/expect_tests/main.py
@@ -134,8 +134,15 @@ def find_all_modules():
sys.path.insert(0, '.')
ret = []
+ blacklist = set()
for importer, modname, ispkg in pkgutil.walk_packages(path=['.']):
- if not ispkg and modname.endswith('_test'):
+ if ispkg and getattr(importer.find_module(modname).load_module(modname),
+ '_expect_tests_stop_walk', False):
+ blacklist.add(modname)
+ continue
+ if modname.endswith('_test'):
+ if any(modname.startswith(pkg) for pkg in blacklist):
+ continue
if modname in sys.modules:
ret.append(sys.modules[modname])
else:
« no previous file with comments | « expect_tests/__init__.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698