mirror of https://github.com/zulip/zulip.git
run-mypy: Check PROVISION_VERSION.
Since new mypy versions frequently break old versions, this check is a useful way to help prevent problems where mypy output is wrong. We could probably tighten this by checking explicitly the expected mypy version from requirements.txt, but that's work. Replaces #5026.
This commit is contained in:
parent
e22920bef6
commit
f7cfd76403
|
@ -15,6 +15,11 @@ from typing import cast, Dict, List
|
||||||
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
os.chdir(os.path.dirname(TOOLS_DIR))
|
os.chdir(os.path.dirname(TOOLS_DIR))
|
||||||
|
|
||||||
|
sys.path.append(os.path.dirname(TOOLS_DIR))
|
||||||
|
from lib import sanity_check
|
||||||
|
sanity_check.check_venv(__file__)
|
||||||
|
from lib.test_script import get_provisioning_status
|
||||||
|
|
||||||
exclude_common = """
|
exclude_common = """
|
||||||
zproject/settings.py
|
zproject/settings.py
|
||||||
zproject/test_settings.py
|
zproject/test_settings.py
|
||||||
|
@ -47,12 +52,22 @@ parser.add_argument('--no-ignore-missing-imports', dest='ignore_missing_imports'
|
||||||
help="""Don't use the --ignore-missing-imports flag with mypy""")
|
help="""Don't use the --ignore-missing-imports flag with mypy""")
|
||||||
parser.add_argument('--quick', action='store_true', default=False,
|
parser.add_argument('--quick', action='store_true', default=False,
|
||||||
help="""Use the --quick flag with mypy""")
|
help="""Use the --quick flag with mypy""")
|
||||||
|
parser.add_argument('--force', default=False,
|
||||||
|
action="store_true",
|
||||||
|
help='Run tests despite possible provisioning problems.')
|
||||||
|
|
||||||
group = parser.add_mutually_exclusive_group()
|
group = parser.add_mutually_exclusive_group()
|
||||||
group.add_argument('--py2', default=False, action='store_true', help="Use Python 2 mode")
|
group.add_argument('--py2', default=False, action='store_true', help="Use Python 2 mode")
|
||||||
group.add_argument('--py3', default=False, action='store_true', help="Use Python 3 mode")
|
group.add_argument('--py3', default=False, action='store_true', help="Use Python 3 mode")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if not args.force:
|
||||||
|
ok, msg = get_provisioning_status()
|
||||||
|
if not ok:
|
||||||
|
print(msg)
|
||||||
|
print('If you really know what you are doing, use --force to run anyway.')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if args.py2:
|
if args.py2:
|
||||||
py_version = 2
|
py_version = 2
|
||||||
elif args.py3:
|
elif args.py3:
|
||||||
|
|
Loading…
Reference in New Issue