From e900a88468860dbee8b8a9d0c048affb1cb74de6 Mon Sep 17 00:00:00 2001 From: "Michael J. Sullivan" Date: Fri, 16 Nov 2018 11:12:19 -0800 Subject: [PATCH] tweaks --- misc/test_installed_version.sh | 4 ++-- mypy/test/testcmdline.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/test_installed_version.sh b/misc/test_installed_version.sh index 48ad2103de0d..3b36fc86737f 100755 --- a/misc/test_installed_version.sh +++ b/misc/test_installed_version.sh @@ -12,7 +12,7 @@ PYTHON="${2-python3}" VENV="$(mktemp -d --tmpdir mypy-test-venv.XXXXXXXXXX)" trap "rm -rf '$VENV'" EXIT -"$PYTHON" -m virtualenv "$VENV" +"$PYTHON" -m venv "$VENV" source "$VENV/bin/activate" pip install -r test-requirements.txt @@ -26,7 +26,7 @@ cp pytest.ini conftest.py "$VENV/" ROOT="$PWD" # Change directory so we can't pick up any of the stuff in the root -cd / +cd "$VENV" # Find the directory that mypy tests were installed into MYPY_TEST_DIR="$(python3 -c 'import mypy.test; print(mypy.test.__path__[0])')" diff --git a/mypy/test/testcmdline.py b/mypy/test/testcmdline.py index 4c368c208d74..b47afce62936 100644 --- a/mypy/test/testcmdline.py +++ b/mypy/test/testcmdline.py @@ -124,6 +124,8 @@ def normalize_file_output(content: List[str], current_abs_path: str) -> List[str result = [x.replace(current_abs_path, '$PWD') for x in content] version = mypy.version.__version__ result = [re.sub(r'\b' + re.escape(version) + r'\b', '$VERSION', x) for x in result] + # We generate a new mypy.version when building mypy wheels that + # lacks base_version, so handle that case. base_version = getattr(mypy.version, 'base_version', version) result = [re.sub(r'\b' + re.escape(base_version) + r'\b', '$VERSION', x) for x in result] result = [timestamp_regex.sub('$TIMESTAMP', x) for x in result]