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

Unified Diff: third_party/typ/run

Issue 2317473002: Revert of Roll typ to v0.9.7. (Closed)
Patch Set: Created 4 years, 3 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 | « third_party/typ/codereview.settings ('k') | third_party/typ/typ/json_results.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/typ/run
diff --git a/third_party/typ/run b/third_party/typ/run
index 4c0e8097fc0135f86871ce54a9c557f757ba7efb..9bea31fbb4ba704cf9f277d3c1f082b7e351af59 100755
--- a/third_party/typ/run
+++ b/third_party/typ/run
@@ -10,8 +10,9 @@
from tools import cov
+is_python3 = bool(sys.version_info.major == 3)
+has_python34 = False
verbose = False
-
repo_dir = os.path.abspath(os.path.dirname(__file__))
path_to_cov = os.path.join(repo_dir, 'tools', 'cov.py')
path_to_runner = os.path.join(repo_dir, 'typ', 'runner.py')
@@ -27,6 +28,8 @@
def main(argv):
parser = argparse.ArgumentParser(prog='run')
+ parser.add_argument('--no3', action='store_true',
+ help='Do not run the tests under Python 3.')
parser.add_argument('-v', '--verbose', action='store_true')
subps = parser.add_subparsers()
@@ -57,6 +60,13 @@
global verbose
if args.verbose:
verbose = True
+ global has_python34
+ if not args.no3:
+ try:
+ ver = subprocess.check_output(['python3', '--version'])
+ has_python34 = ver.split()[1] >= '3.4'
+ except:
+ pass
args.func(args)
@@ -71,8 +81,11 @@
args.source = [os.path.join(repo_dir, 'typ')]
argv = cov.argv_from_args(args)
cov_args = [path_to_runner, '-j', '1']
- python = sys.executable
- call([python, path_to_cov] + argv + cov_args)
+ print('Running coverage of unit tests for Python 2.7.')
+ call(['python', path_to_cov] + argv + cov_args)
+ if has_python34:
+ print('Running coverage of unit tests for Python 3.4.')
+ call(['python3', path_to_cov] + argv + cov_args)
def run_help(args):
@@ -86,17 +99,20 @@
def run_tests(args):
- python = sys.executable
- # Test running the typ module directly if it is in sys.path.
- call([python, '-m', 'typ', 'typ.tests.main_test.TestMain.test_basic'])
+ print('Testing running the typ module directly if it is in sys.path.')
+ call(['python', '-m', 'typ', 'typ.tests.main_test.TestMain.test_basic'])
- # Testing running the runner directly if nothing is in sys.path.'
+ print('Testing running the runner directly if nothing is in sys.path.')
home_dir = os.environ['HOME']
- call([python, path_to_runner, 'typ.tests.main_test.TestMain.test_basic'],
+ call(['python', path_to_runner, 'typ.tests.main_test.TestMain.test_basic'],
cwd=home_dir)
- # Run the remaining tests.
- call([python, path_to_runner])
+ # Now run all the tests under Python2 and Python3.
+ print('Running the unit tests under Python 2.')
+ call(['python', path_to_runner])
+ if has_python34:
+ print('Running the unit tests under Python 3.4.')
+ call(['python3', path_to_runner])
if __name__ == '__main__':
« no previous file with comments | « third_party/typ/codereview.settings ('k') | third_party/typ/typ/json_results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698