run-mypy: Move "which mypy" noise into --version, and use in Travis.

Printing the version in Travis builds will help in debugging when we
get different results there from locally.  The new `--version` path
also gives us a handy place to put the "what mypy command are we running"
diagnostic, getting it out of the way of normal interactive use.
This commit is contained in:
Greg Price 2017-09-26 14:38:56 -07:00 committed by Greg Price
parent 9ef68d6d42
commit 103178ffb2
2 changed files with 3 additions and 2 deletions

View File

@ -27,7 +27,7 @@ parser = argparse.ArgumentParser(description="Run mypy on files tracked by git."
parser.add_argument('targets', nargs='*', parser.add_argument('targets', nargs='*',
help="files and directories to check (default: .)") help="files and directories to check (default: .)")
parser.add_argument('--version', action='store_true', parser.add_argument('--version', action='store_true',
help="just run mypy --version") help="show mypy version information and exit")
parser.add_argument('--quick', action='store_true', parser.add_argument('--quick', action='store_true',
help="pass --quick to mypy") help="pass --quick to mypy")
parser.add_argument('-m', '--modified', action='store_true', parser.add_argument('-m', '--modified', action='store_true',
@ -64,11 +64,11 @@ VENV_DIR = "/srv/zulip-py3-venv"
MYPY_VENV_PATH = os.path.join(VENV_DIR, "bin", "mypy") MYPY_VENV_PATH = os.path.join(VENV_DIR, "bin", "mypy")
if os.path.exists(MYPY_VENV_PATH): if os.path.exists(MYPY_VENV_PATH):
mypy_command = MYPY_VENV_PATH mypy_command = MYPY_VENV_PATH
print("Using mypy from", mypy_command)
else: else:
mypy_command = "mypy" mypy_command = "mypy"
if args.version: if args.version:
print("mypy command:", mypy_command)
sys.exit(subprocess.call([mypy_command, "--version"])) sys.exit(subprocess.call([mypy_command, "--version"]))
if args.all: if args.all:

View File

@ -12,6 +12,7 @@ set -x
# We run mypy after the backend tests so we get output from the # We run mypy after the backend tests so we get output from the
# backend tests, which tend to uncover more serious problems, first. # backend tests, which tend to uncover more serious problems, first.
./tools/run-mypy --version
./tools/run-mypy --linecoverage-report ./tools/run-mypy --linecoverage-report
./tools/test-migrations ./tools/test-migrations