Index: go/test.py |
diff --git a/go/test.py b/go/test.py |
index 14638d50ae06c8d06757598e45f5b02c8cf2d967..4fcf41eaaeed151696a09f8c799071ba0c46c3f4 100755 |
--- a/go/test.py |
+++ b/go/test.py |
@@ -89,7 +89,7 @@ def get_package_info(package): |
*.infra_testing contains a JSON dict with the following keys: |
{ |
// Do not run tests in this package at all. Default 'false'. |
- "skip_testing": boolean, |
+ "skip_testing": boolean or a list of platforms to skip tests on, |
iannucci
2015/05/13 08:18:19
why not always a list of platforms?
Vadim Sh.
2015/05/13 22:57:24
Okay...
|
// Minimum allowed code coverage percentage, see below. Default '100'. |
"expected_coverage_min": number, |
// Maximum allowed code coverage percentage, see below. Default '100'. |
@@ -140,15 +140,20 @@ def get_package_info(package): |
def should_skip(package): |
"""True to skip package tests, reads 'skip_testing' from *.infra_testing.""" |
- return get_package_info(package).get('skip_testing', False) |
+ skip = get_package_info(package).get('skip_testing', False) |
+ if isinstance(skip, list): |
+ return sys.platform in skip |
iannucci
2015/05/13 08:18:19
return sys.platform.startswith(skip)
maybe?
Then
Vadim Sh.
2015/05/13 22:57:24
[""] is sort of confusing...
Made it GOOS ("darw
|
+ return bool(skip) |
+ |
def get_build_tags(package): |
- """True to skip package tests, reads 'skip_testing' from *.infra_testing.""" |
+ """Build tags to use when building a package, read from *.infra_testing.""" |
tags = get_package_info(package).get('build_tags', ()) |
if tags: |
return '-tags='+(','.join(tags)) |
return None |
+ |
def get_expected_coverage(package): |
"""Returns allowed code coverage percentage as a pair (min, max).""" |
info = get_package_info(package) |
@@ -257,7 +262,15 @@ def run_tests(package_root, coverage_dir): |
# Code coverage report requires tests to be run against a single package, so |
# discover all individual packages. |
- packages = [p for p in list_packages(package_root) if not should_skip(p)] |
+ skipped = [] |
+ packages = [] |
+ for p in list_packages(package_root): |
+ if should_skip(p): |
+ skipped.append(p) |
+ else: |
+ packages.append(p) |
+ if skipped: |
+ print 'Skipping %d packages' % len(skipped) |
if not packages: |
print 'No tests to run' |
return 0 |