Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Pipelines: Test Windows on Python 3.8 #7320

Merged
merged 4 commits into from
Jan 13, 2020

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Nov 9, 2019

For #7229.

Python 3.8 is now available on Azure Pipelines: https://github.com/microsoft/azure-pipelines-image-generation/issues/1317#issuecomment-551965427.

I wasn't sure what the logic for calculating maxParallel, so I incremented it in the places where I added a new 3.8 job.

Please let me know if it should be adjusted.

This PR is for Windows. (See #7321 for Linux and macOS.)

@hugovk hugovk changed the title Test Windows on Python 3.8 Azure Pipelines: Test Windows on Python 3.8 Nov 9, 2019
@hugovk
Copy link
Contributor Author

hugovk commented Nov 9, 2019

Created as a draft PR because it is currently failing on 3.8:

Error output
================================== FAILURES ===================================
__________ test_expanduser[/Users/test-~/.cache-/Users/test/.cache] ___________
[gw0] win32 -- Python 3.8.0 d:\a\1\s\.tox\py\scripts\python.exe

home = '/Users/test', path = '~/.cache', expanded = '/Users/test/.cache'
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x000001D9F6AD43A0>

    @pytest.mark.parametrize("home,path,expanded", [
        ("/Users/test", "~", "/Users/test"),
        ("/Users/test", "~/.cache", "/Users/test/.cache"),
        # Verify that we are not affected by https://bugs.python.org/issue14768
        ("/", "~", "/"),
        ("/", "~/.cache", "/.cache"),
    ])
    def test_expanduser(home, path, expanded, monkeypatch):
        monkeypatch.setenv("HOME", home)
>       assert expanduser(path) == expanded
E       AssertionError: assert 'R:\\Temp\\py...\\home/.cache' == '/Users/test/.cache'
E         - R:\Temp\pytest-of-VssAdministrator\pytest-0\popen-gw0\test_expanduser__Users_test___0\home/.cache
E         + /Users/test/.cache

tests\unit\test_compat.py:147: AssertionError
_____________________ test_expanduser[/-~/.cache-/.cache] _____________________
[gw0] win32 -- Python 3.8.0 d:\a\1\s\.tox\py\scripts\python.exe

home = '/', path = '~/.cache', expanded = '/.cache'
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x000001D9F6AC9DC0>

    @pytest.mark.parametrize("home,path,expanded", [
        ("/Users/test", "~", "/Users/test"),
        ("/Users/test", "~/.cache", "/Users/test/.cache"),
        # Verify that we are not affected by https://bugs.python.org/issue14768
        ("/", "~", "/"),
        ("/", "~/.cache", "/.cache"),
    ])
    def test_expanduser(home, path, expanded, monkeypatch):
        monkeypatch.setenv("HOME", home)
>       assert expanduser(path) == expanded
E       AssertionError: assert 'R:\\Temp\\py...\\home/.cache' == '/.cache'
E         - R:\Temp\pytest-of-VssAdministrator\pytest-0\popen-gw0\test_expanduser______cache___c0\home/.cache
E         + /.cache

tests\unit\test_compat.py:147: AssertionError
_________________ test_expanduser[/Users/test-~-/Users/test] __________________
[gw1] win32 -- Python 3.8.0 d:\a\1\s\.tox\py\scripts\python.exe

home = '/Users/test', path = '~', expanded = '/Users/test'
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x00000236CBF96370>

    @pytest.mark.parametrize("home,path,expanded", [
        ("/Users/test", "~", "/Users/test"),
        ("/Users/test", "~/.cache", "/Users/test/.cache"),
        # Verify that we are not affected by https://bugs.python.org/issue14768
        ("/", "~", "/"),
        ("/", "~/.cache", "/.cache"),
    ])
    def test_expanduser(home, path, expanded, monkeypatch):
        monkeypatch.setenv("HOME", home)
>       assert expanduser(path) == expanded
E       AssertionError: assert 'R:\\Temp\\py...est___0\\home' == '/Users/test'
E         - R:\Temp\pytest-of-VssAdministrator\pytest-0\popen-gw1\test_expanduser__Users_test___0\home
E         + /Users/test

tests\unit\test_compat.py:147: AssertionError
___________________________ test_expanduser[/-~-/] ____________________________
[gw1] win32 -- Python 3.8.0 d:\a\1\s\.tox\py\scripts\python.exe

home = '/', path = '~', expanded = '/'
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x00000236CBF96640>

    @pytest.mark.parametrize("home,path,expanded", [
        ("/Users/test", "~", "/Users/test"),
        ("/Users/test", "~/.cache", "/Users/test/.cache"),
        # Verify that we are not affected by https://bugs.python.org/issue14768
        ("/", "~", "/"),
        ("/", "~/.cache", "/.cache"),
    ])
    def test_expanduser(home, path, expanded, monkeypatch):
        monkeypatch.setenv("HOME", home)
>       assert expanduser(path) == expanded
E       AssertionError: assert 'R:\\Temp\\py...______0\\home' == '/'
E         - R:\Temp\pytest-of-VssAdministrator\pytest-0\popen-gw1\test_expanduser_______0\home
E         + /

tests\unit\test_compat.py:147: AssertionError

Any ideas why?

@hugovk hugovk mentioned this pull request Nov 9, 2019
5 tasks
@hugovk
Copy link
Contributor Author

hugovk commented Nov 9, 2019

Python 3.8 also fails on AppVeyor with the same 4 FAILs and 5 new ERRORs:

FAIL tests/unit/test_compat.py::test_expanduser[/Users/test-~-/Users/test]
FAIL tests/unit/test_compat.py::test_expanduser[/-~-/]
FAIL tests/unit/test_compat.py::test_expanduser[/Users/test-~/.cache-/Users/test/.cache]
FAIL tests/unit/test_compat.py::test_expanduser[/-~/.cache-/.cache]
ERROR tests/unit/test_build_env.py::test_build_env_allow_only_one_install
ERROR tests/unit/test_build_env.py::test_build_env_requirements_check
ERROR tests/unit/test_build_env.py::test_build_env_overlay_prefix_has_priority
ERROR tests/unit/test_build_env.py::test_build_env_isolation
ERROR tests/unit/test_wheel_builder.py::test_should_cache_git_sha

IN case they're related, the log is below and at https://ci.appveyor.com/project/hugovk/pip/builds/28736540/job/xl59c0khq23liwhv.

Error output
=================================== ERRORS ====================================
___________ ERROR at setup of test_build_env_allow_only_one_install ___________
[gw0] win32 -- Python 3.8.0 c:\projects\pip\.tox\py\scripts\python.exe
request = <SubRequest 'virtualenv_template' for <Function 'test_build_env_allow_only_one_install'>>
tmpdir_factory = <_pytest.tmpdir.TempdirFactory object at 0x00000034F93792E0>
pip_src = Path('C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\pip_src0\\pip_src')
setuptools_install = Path('C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\setuptools0\\install')
common_wheels = Path('C:\\projects\\pip\\tests\\data\\common_wheels')
    @pytest.fixture(scope='session')
    def virtualenv_template(request, tmpdir_factory, pip_src,
                            setuptools_install, common_wheels):
    
        if six.PY3 and request.config.getoption('--use-venv'):
            venv_type = 'venv'
        else:
            venv_type = 'virtualenv'
    
        # Create the virtual environment
        tmpdir = Path(str(tmpdir_factory.mktemp('virtualenv')))
>       venv = VirtualEnvironment(
            tmpdir.joinpath("venv_orig"), venv_type=venv_type
        )
tests\conftest.py:243: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests\lib\venv.py:32: in __init__
    self._create()
tests\lib\venv.py:66: in _create
    _virtualenv.create_environment(
.tox\py\lib\site-packages\virtualenv.py:1158: in create_environment
    install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
home_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv0\\venv_orig'
lib_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv0\\venv_orig\\Lib'
inc_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv0\\venv_orig\\Include'
bin_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv0\\venv_orig\\Scripts'
site_packages = False, clear = False, symlink = True
    def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, symlink=True):
        """Install just the base environment, no distutils patches etc"""
        if sys.executable.startswith(bin_dir):
            print("Please use the *system* python to run this script")
            return
    
        if clear:
            rm_tree(lib_dir)
            # FIXME: why not delete it?
            # Maybe it should delete everything with #!/path/to/venv/python in it
            logger.notify("Not deleting %s", bin_dir)
    
        if hasattr(sys, "real_prefix"):
            logger.notify("Using real prefix %r", sys.real_prefix)
            prefix = sys.real_prefix
        elif hasattr(sys, "base_prefix"):
            logger.notify("Using base prefix %r", sys.base_prefix)
            prefix = sys.base_prefix
        else:
            prefix = sys.prefix
        prefix = os.path.abspath(prefix)
        mkdir(lib_dir)
        fix_lib64(lib_dir, symlink)
        stdlib_dirs = [os.path.dirname(os.__file__)]
        if IS_WIN:
            stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), "DLLs"))
        elif IS_DARWIN:
            stdlib_dirs.append(join(stdlib_dirs[0], "site-packages"))
        if hasattr(os, "symlink"):
            logger.info("Symlinking Python bootstrap modules")
        else:
            logger.info("Copying Python bootstrap modules")
        logger.indent += 2
        try:
            # copy required files...
            for stdlib_dir in stdlib_dirs:
                copy_required_files(stdlib_dir, lib_dir, symlink)
            # ...and modules
            copy_required_modules(home_dir, symlink)
            copy_license(prefix, home_dir, lib_dir, symlink)
        finally:
            logger.indent -= 2
        # ...copy tcl/tk
        if IS_WIN:
            copy_tcltk(prefix, home_dir, symlink)
        mkdir(join(lib_dir, "site-packages"))
        import site
    
        site_filename = site.__file__
        if site_filename.endswith(".pyc") or site_filename.endswith(".pyo"):
            site_filename = site_filename[:-1]
        elif site_filename.endswith("$py.class"):
            site_filename = site_filename.replace("$py.class", ".py")
        site_filename_dst = change_prefix(site_filename, home_dir)
        site_dir = os.path.dirname(site_filename_dst)
        writefile(site_filename_dst, SITE_PY)
        writefile(join(site_dir, "orig-prefix.txt"), prefix)
        site_packages_filename = join(site_dir, "no-global-site-packages.txt")
        if not site_packages:
            writefile(site_packages_filename, "")
    
        if IS_PYPY or IS_WIN:
            standard_lib_include_dir = join(prefix, "include")
        else:
            standard_lib_include_dir = join(prefix, "include", PY_VERSION + ABI_FLAGS)
        if os.path.exists(standard_lib_include_dir):
            copy_include_dir(standard_lib_include_dir, inc_dir, symlink)
        else:
            logger.debug("No include dir %s", standard_lib_include_dir)
    
        platform_include_dir = distutils.sysconfig.get_python_inc(plat_specific=1)
        if platform_include_dir != standard_lib_include_dir:
            platform_include_dest = distutils.sysconfig.get_python_inc(plat_specific=1, prefix=home_dir)
            if platform_include_dir == platform_include_dest:
                # Do platinc_dest manually due to a CPython bug;
                # not http://bugs.python.org/issue3386 but a close cousin
                platform_include_dest = subst_path(platform_include_dir, prefix, home_dir)
            if platform_include_dest:
                # PyPy's stdinc_dir and prefix are relative to the original binary
                # (traversing virtualenvs), whereas the platinc_dir is relative to
                # the inner virtualenv and ignores the prefix argument.
                # This seems more evolved than designed.
                copy_include_dir(platform_include_dir, platform_include_dest, symlink)
    
        # pypy never uses exec_prefix, just ignore it
        if os.path.realpath(sys.exec_prefix) != os.path.realpath(prefix) and not IS_PYPY:
            if IS_WIN:
                exec_dir = join(sys.exec_prefix, "lib")
            else:
                exec_dir = join(sys.exec_prefix, "lib", PY_VERSION)
            copy_required_files(exec_dir, lib_dir, symlink)
    
        mkdir(bin_dir)
        py_executable = join(bin_dir, os.path.basename(sys.executable))
        if "Python.framework" in prefix or "Python3.framework" in prefix:
            # OS X framework builds cause validation to break
            # https://github.com/pypa/virtualenv/issues/322
            if os.environ.get("__PYVENV_LAUNCHER__"):
                del os.environ["__PYVENV_LAUNCHER__"]
            if re.search(r"/Python(?:-32|-64)*$", py_executable):
                # The name of the python executable is not quite what
                # we want, rename it.
                py_executable = os.path.join(os.path.dirname(py_executable), "python")
    
        logger.notify("New %s executable in %s", EXPECTED_EXE, py_executable)
        pc_build_dir = os.path.dirname(sys.executable)
        pyd_pth = os.path.join(lib_dir, "site-packages", "virtualenv_builddir_pyd.pth")
        if IS_WIN and os.path.exists(os.path.join(pc_build_dir, "build.bat")):
            logger.notify("Detected python running from build directory %s", pc_build_dir)
            logger.notify("Writing .pth file linking to build directory for *.pyd files")
            writefile(pyd_pth, pc_build_dir)
        else:
            if os.path.exists(pyd_pth):
                logger.info("Deleting %s (not Windows env or not build directory python)", pyd_pth)
                os.unlink(pyd_pth)
    
        if sys.executable != py_executable:
            # FIXME: could I just hard link?
            executable = sys.executable
            shutil.copyfile(executable, py_executable)
            make_exe(py_executable)
            if IS_WIN or IS_CYGWIN:
                python_w = os.path.join(os.path.dirname(sys.executable), "pythonw.exe")
                if os.path.exists(python_w):
                    logger.info("Also created pythonw.exe")
                    shutil.copyfile(python_w, os.path.join(os.path.dirname(py_executable), "pythonw.exe"))
                python_d = os.path.join(os.path.dirname(sys.executable), "python_d.exe")
                python_d_dest = os.path.join(os.path.dirname(py_executable), "python_d.exe")
                if os.path.exists(python_d):
                    logger.info("Also created python_d.exe")
                    shutil.copyfile(python_d, python_d_dest)
                elif os.path.exists(python_d_dest):
                    logger.info("Removed python_d.exe as it is no longer at the source")
                    os.unlink(python_d_dest)
    
                # we need to copy the DLL to enforce that windows will load the correct one.
                # may not exist if we are cygwin.
                if IS_PYPY:
                    py_executable_dll_s = [("libpypy-c.dll", "libpypy_d-c.dll")]
                else:
                    py_executable_dll_s = [
                        ("python{}.dll".format(sys.version_info[0]), "python{}_d.dll".format(sys.version_info[0])),
                        (
                            "python{}{}.dll".format(sys.version_info[0], sys.version_info[1]),
                            "python{}{}_d.dll".format(sys.version_info[0], sys.version_info[1]),
                        ),
                    ]
    
                for py_executable_dll, py_executable_dll_d in py_executable_dll_s:
                    python_dll = os.path.join(os.path.dirname(sys.executable), py_executable_dll)
                    python_dll_d = os.path.join(os.path.dirname(sys.executable), py_executable_dll_d)
                    python_dll_d_dest = os.path.join(os.path.dirname(py_executable), py_executable_dll_d)
                    if os.path.exists(python_dll):
                        logger.info("Also created %s", py_executable_dll)
                        shutil.copyfile(python_dll, os.path.join(os.path.dirname(py_executable), py_executable_dll))
                    if os.path.exists(python_dll_d):
                        logger.info("Also created %s", py_executable_dll_d)
                        shutil.copyfile(python_dll_d, python_dll_d_dest)
                    elif os.path.exists(python_dll_d_dest):
                        logger.info("Removed %s as the source does not exist", python_dll_d_dest)
                        os.unlink(python_dll_d_dest)
            if IS_PYPY:
                # make a symlink python --> pypy-c
                python_executable = os.path.join(os.path.dirname(py_executable), "python")
                if IS_WIN or IS_CYGWIN:
                    python_executable += ".exe"
                logger.info("Also created executable %s", python_executable)
                copyfile(py_executable, python_executable, symlink)
    
                if IS_WIN:
                    for name in ["libexpat.dll", "libeay32.dll", "ssleay32.dll", "sqlite3.dll", "tcl85.dll", "tk85.dll"]:
                        src = join(prefix, name)
                        if os.path.exists(src):
                            copyfile(src, join(bin_dir, name), symlink)
    
                    for d in sys.path:
                        if d.endswith("lib_pypy"):
                            break
                    else:
                        logger.fatal("Could not find lib_pypy in sys.path")
                        raise SystemExit(3)
                    logger.info("Copying lib_pypy")
                    copyfile(d, os.path.join(home_dir, "lib_pypy"), symlink)
    
        if os.path.splitext(os.path.basename(py_executable))[0] != EXPECTED_EXE:
            secondary_exe = os.path.join(os.path.dirname(py_executable), EXPECTED_EXE)
            py_executable_ext = os.path.splitext(py_executable)[1]
            if py_executable_ext.lower() == ".exe":
                # python2.4 gives an extension of '.4' :P
                secondary_exe += py_executable_ext
            if os.path.exists(secondary_exe):
                logger.warn(
                    "Not overwriting existing {} script {} (you must use {})".format(
                        EXPECTED_EXE, secondary_exe, py_executable
                    )
                )
            else:
                logger.notify("Also creating executable in %s", secondary_exe)
                shutil.copyfile(sys.executable, secondary_exe)
                make_exe(secondary_exe)
    
        if ".framework" in prefix:
            original_python = None
            if "Python.framework" in prefix or "Python3.framework" in prefix:
                logger.debug("MacOSX Python framework detected")
                # Make sure we use the embedded interpreter inside
                # the framework, even if sys.executable points to
                # the stub executable in ${sys.prefix}/bin
                # See http://groups.google.com/group/python-virtualenv/
                #                              browse_thread/thread/17cab2f85da75951
                original_python = os.path.join(prefix, "Resources/Python.app/Contents/MacOS/Python")
            if "EPD" in prefix:
                logger.debug("EPD framework detected")
                original_python = os.path.join(prefix, "bin/python")
            shutil.copy(original_python, py_executable)
    
            # Copy the framework's dylib into the virtual
            # environment
            virtual_lib = os.path.join(home_dir, ".Python")
    
            if os.path.exists(virtual_lib):
                os.unlink(virtual_lib)
            lib_name = "Python3" if "Python3.framework" in prefix else "Python"
            copyfile(os.path.join(prefix, lib_name), virtual_lib, symlink)
    
            # And then change the install_name of the copied python executable
            search = (
                "@executable_path/../../../../Python3" if "Python3.framework" in prefix else os.path.join(prefix, lib_name)
            )
            # noinspection PyBroadException
            try:
                mach_o_change(py_executable, search, "@executable_path/../.Python")
            except Exception:
                e = sys.exc_info()[1]
                logger.warn("Could not call mach_o_change: %s. " "Trying to call install_name_tool instead.", e)
                try:
                    call_subprocess(["install_name_tool", "-change", search, "@executable_path/../.Python", py_executable])
                except Exception:
                    logger.fatal("Could not call install_name_tool -- you must " "have Apple's development tools installed")
                    raise
    
        if not IS_WIN:
            # Ensure that 'python', 'pythonX' and 'pythonX.Y' all exist
            py_exe_version_major = "python{}".format(sys.version_info[0])
            py_exe_version_major_minor = "python{}.{}".format(sys.version_info[0], sys.version_info[1])
            py_exe_no_version = "python"
            required_symlinks = [py_exe_no_version, py_exe_version_major, py_exe_version_major_minor]
    
            py_executable_base = os.path.basename(py_executable)
    
            if py_executable_base in required_symlinks:
                # Don't try to symlink to yourself.
                required_symlinks.remove(py_executable_base)
    
            for pth in required_symlinks:
                full_pth = join(bin_dir, pth)
                if os.path.exists(full_pth):
                    os.unlink(full_pth)
                if symlink:
                    os.symlink(py_executable_base, full_pth)
                else:
                    copyfile(py_executable, full_pth, symlink)
    
        cmd = [
            py_executable,
            "-c",
            "import sys;out=sys.stdout;" 'getattr(out, "buffer", out).write(sys.prefix.encode("utf-8"))',
        ]
        logger.info('Testing executable with %s %s "%s"', *cmd)
        try:
            proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
            proc_stdout, proc_stderr = proc.communicate()
        except OSError:
            e = sys.exc_info()[1]
            if e.errno == errno.EACCES:
                logger.fatal("ERROR: The executable {} could not be run: {}".format(py_executable, e))
                sys.exit(100)
            else:
                raise e
    
        proc_stdout = proc_stdout.strip().decode("utf-8")
        # normalize paths using realpath to ensure that a virtualenv correctly identifies itself even
        # when addressed over a symlink
        proc_stdout = os.path.normcase(os.path.realpath(proc_stdout))
        norm_home_dir = os.path.normcase(os.path.realpath(home_dir))
        if hasattr(norm_home_dir, "decode"):
            norm_home_dir = norm_home_dir.decode(sys.getfilesystemencoding())
        if proc_stdout != norm_home_dir:
            logger.fatal("ERROR: The executable %s is not functioning", py_executable)
            logger.fatal("ERROR: It thinks sys.prefix is {!r} (should be {!r})".format(proc_stdout, norm_home_dir))
            logger.fatal("ERROR: virtualenv is not compatible with this system or executable")
            if IS_WIN:
                logger.fatal(
                    "Note: some Windows users have reported this error when they "
                    'installed Python for "Only this user" or have multiple '
                    "versions of Python installed. Copying the appropriate "
                    "PythonXX.dll to the virtualenv Scripts/ directory may fix "
                    "this problem."
                )
>           sys.exit(100)
E           SystemExit: 100
.tox\py\lib\site-packages\virtualenv.py:1708: SystemExit
---------------------------- Captured stdout setup ----------------------------
ERROR: The executable C:\Users\appveyor\AppData\Local\Temp\1\pytest-of-appveyor\pytest-0\popen-gw0\virtualenv0\venv_orig\Scripts\python.exe is not functioning
ERROR: It thinks sys.prefix is 'c:\\projects\\pip' (should be 'c:\\users\\appveyor\\appdata\\local\\temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv0\\venv_orig')
ERROR: virtualenv is not compatible with this system or executable
Note: some Windows users have reported this error when they installed Python for "Only this user" or have multiple versions of Python installed. Copying the appropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem.
---------------------------- Captured stderr setup ----------------------------
No pyvenv.cfg file
_____________ ERROR at setup of test_build_env_requirements_check _____________
[gw1] win32 -- Python 3.8.0 c:\projects\pip\.tox\py\scripts\python.exe
request = <SubRequest 'virtualenv_template' for <Function 'test_build_env_requirements_check'>>
tmpdir_factory = <_pytest.tmpdir.TempdirFactory object at 0x00000031FCB992E0>
pip_src = Path('C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\pip_src0\\pip_src')
setuptools_install = Path('C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\setuptools0\\install')
common_wheels = Path('C:\\projects\\pip\\tests\\data\\common_wheels')
    @pytest.fixture(scope='session')
    def virtualenv_template(request, tmpdir_factory, pip_src,
                            setuptools_install, common_wheels):
    
        if six.PY3 and request.config.getoption('--use-venv'):
            venv_type = 'venv'
        else:
            venv_type = 'virtualenv'
    
        # Create the virtual environment
        tmpdir = Path(str(tmpdir_factory.mktemp('virtualenv')))
>       venv = VirtualEnvironment(
            tmpdir.joinpath("venv_orig"), venv_type=venv_type
        )
tests\conftest.py:243: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests\lib\venv.py:32: in __init__
    self._create()
tests\lib\venv.py:66: in _create
    _virtualenv.create_environment(
.tox\py\lib\site-packages\virtualenv.py:1158: in create_environment
    install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
home_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\virtualenv0\\venv_orig'
lib_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\virtualenv0\\venv_orig\\Lib'
inc_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\virtualenv0\\venv_orig\\Include'
bin_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\virtualenv0\\venv_orig\\Scripts'
site_packages = False, clear = False, symlink = True
    def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, symlink=True):
        """Install just the base environment, no distutils patches etc"""
        if sys.executable.startswith(bin_dir):
            print("Please use the *system* python to run this script")
            return
    
        if clear:
            rm_tree(lib_dir)
            # FIXME: why not delete it?
            # Maybe it should delete everything with #!/path/to/venv/python in it
            logger.notify("Not deleting %s", bin_dir)
    
        if hasattr(sys, "real_prefix"):
            logger.notify("Using real prefix %r", sys.real_prefix)
            prefix = sys.real_prefix
        elif hasattr(sys, "base_prefix"):
            logger.notify("Using base prefix %r", sys.base_prefix)
            prefix = sys.base_prefix
        else:
            prefix = sys.prefix
        prefix = os.path.abspath(prefix)
        mkdir(lib_dir)
        fix_lib64(lib_dir, symlink)
        stdlib_dirs = [os.path.dirname(os.__file__)]
        if IS_WIN:
            stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), "DLLs"))
        elif IS_DARWIN:
            stdlib_dirs.append(join(stdlib_dirs[0], "site-packages"))
        if hasattr(os, "symlink"):
            logger.info("Symlinking Python bootstrap modules")
        else:
            logger.info("Copying Python bootstrap modules")
        logger.indent += 2
        try:
            # copy required files...
            for stdlib_dir in stdlib_dirs:
                copy_required_files(stdlib_dir, lib_dir, symlink)
            # ...and modules
            copy_required_modules(home_dir, symlink)
            copy_license(prefix, home_dir, lib_dir, symlink)
        finally:
            logger.indent -= 2
        # ...copy tcl/tk
        if IS_WIN:
            copy_tcltk(prefix, home_dir, symlink)
        mkdir(join(lib_dir, "site-packages"))
        import site
    
        site_filename = site.__file__
        if site_filename.endswith(".pyc") or site_filename.endswith(".pyo"):
            site_filename = site_filename[:-1]
        elif site_filename.endswith("$py.class"):
            site_filename = site_filename.replace("$py.class", ".py")
        site_filename_dst = change_prefix(site_filename, home_dir)
        site_dir = os.path.dirname(site_filename_dst)
        writefile(site_filename_dst, SITE_PY)
        writefile(join(site_dir, "orig-prefix.txt"), prefix)
        site_packages_filename = join(site_dir, "no-global-site-packages.txt")
        if not site_packages:
            writefile(site_packages_filename, "")
    
        if IS_PYPY or IS_WIN:
            standard_lib_include_dir = join(prefix, "include")
        else:
            standard_lib_include_dir = join(prefix, "include", PY_VERSION + ABI_FLAGS)
        if os.path.exists(standard_lib_include_dir):
            copy_include_dir(standard_lib_include_dir, inc_dir, symlink)
        else:
            logger.debug("No include dir %s", standard_lib_include_dir)
    
        platform_include_dir = distutils.sysconfig.get_python_inc(plat_specific=1)
        if platform_include_dir != standard_lib_include_dir:
            platform_include_dest = distutils.sysconfig.get_python_inc(plat_specific=1, prefix=home_dir)
            if platform_include_dir == platform_include_dest:
                # Do platinc_dest manually due to a CPython bug;
                # not http://bugs.python.org/issue3386 but a close cousin
                platform_include_dest = subst_path(platform_include_dir, prefix, home_dir)
            if platform_include_dest:
                # PyPy's stdinc_dir and prefix are relative to the original binary
                # (traversing virtualenvs), whereas the platinc_dir is relative to
                # the inner virtualenv and ignores the prefix argument.
                # This seems more evolved than designed.
                copy_include_dir(platform_include_dir, platform_include_dest, symlink)
    
        # pypy never uses exec_prefix, just ignore it
        if os.path.realpath(sys.exec_prefix) != os.path.realpath(prefix) and not IS_PYPY:
            if IS_WIN:
                exec_dir = join(sys.exec_prefix, "lib")
            else:
                exec_dir = join(sys.exec_prefix, "lib", PY_VERSION)
            copy_required_files(exec_dir, lib_dir, symlink)
    
        mkdir(bin_dir)
        py_executable = join(bin_dir, os.path.basename(sys.executable))
        if "Python.framework" in prefix or "Python3.framework" in prefix:
            # OS X framework builds cause validation to break
            # https://github.com/pypa/virtualenv/issues/322
            if os.environ.get("__PYVENV_LAUNCHER__"):
                del os.environ["__PYVENV_LAUNCHER__"]
            if re.search(r"/Python(?:-32|-64)*$", py_executable):
                # The name of the python executable is not quite what
                # we want, rename it.
                py_executable = os.path.join(os.path.dirname(py_executable), "python")
    
        logger.notify("New %s executable in %s", EXPECTED_EXE, py_executable)
        pc_build_dir = os.path.dirname(sys.executable)
        pyd_pth = os.path.join(lib_dir, "site-packages", "virtualenv_builddir_pyd.pth")
        if IS_WIN and os.path.exists(os.path.join(pc_build_dir, "build.bat")):
            logger.notify("Detected python running from build directory %s", pc_build_dir)
            logger.notify("Writing .pth file linking to build directory for *.pyd files")
            writefile(pyd_pth, pc_build_dir)
        else:
            if os.path.exists(pyd_pth):
                logger.info("Deleting %s (not Windows env or not build directory python)", pyd_pth)
                os.unlink(pyd_pth)
    
        if sys.executable != py_executable:
            # FIXME: could I just hard link?
            executable = sys.executable
            shutil.copyfile(executable, py_executable)
            make_exe(py_executable)
            if IS_WIN or IS_CYGWIN:
                python_w = os.path.join(os.path.dirname(sys.executable), "pythonw.exe")
                if os.path.exists(python_w):
                    logger.info("Also created pythonw.exe")
                    shutil.copyfile(python_w, os.path.join(os.path.dirname(py_executable), "pythonw.exe"))
                python_d = os.path.join(os.path.dirname(sys.executable), "python_d.exe")
                python_d_dest = os.path.join(os.path.dirname(py_executable), "python_d.exe")
                if os.path.exists(python_d):
                    logger.info("Also created python_d.exe")
                    shutil.copyfile(python_d, python_d_dest)
                elif os.path.exists(python_d_dest):
                    logger.info("Removed python_d.exe as it is no longer at the source")
                    os.unlink(python_d_dest)
    
                # we need to copy the DLL to enforce that windows will load the correct one.
                # may not exist if we are cygwin.
                if IS_PYPY:
                    py_executable_dll_s = [("libpypy-c.dll", "libpypy_d-c.dll")]
                else:
                    py_executable_dll_s = [
                        ("python{}.dll".format(sys.version_info[0]), "python{}_d.dll".format(sys.version_info[0])),
                        (
                            "python{}{}.dll".format(sys.version_info[0], sys.version_info[1]),
                            "python{}{}_d.dll".format(sys.version_info[0], sys.version_info[1]),
                        ),
                    ]
    
                for py_executable_dll, py_executable_dll_d in py_executable_dll_s:
                    python_dll = os.path.join(os.path.dirname(sys.executable), py_executable_dll)
                    python_dll_d = os.path.join(os.path.dirname(sys.executable), py_executable_dll_d)
                    python_dll_d_dest = os.path.join(os.path.dirname(py_executable), py_executable_dll_d)
                    if os.path.exists(python_dll):
                        logger.info("Also created %s", py_executable_dll)
                        shutil.copyfile(python_dll, os.path.join(os.path.dirname(py_executable), py_executable_dll))
                    if os.path.exists(python_dll_d):
                        logger.info("Also created %s", py_executable_dll_d)
                        shutil.copyfile(python_dll_d, python_dll_d_dest)
                    elif os.path.exists(python_dll_d_dest):
                        logger.info("Removed %s as the source does not exist", python_dll_d_dest)
                        os.unlink(python_dll_d_dest)
            if IS_PYPY:
                # make a symlink python --> pypy-c
                python_executable = os.path.join(os.path.dirname(py_executable), "python")
                if IS_WIN or IS_CYGWIN:
                    python_executable += ".exe"
                logger.info("Also created executable %s", python_executable)
                copyfile(py_executable, python_executable, symlink)
    
                if IS_WIN:
                    for name in ["libexpat.dll", "libeay32.dll", "ssleay32.dll", "sqlite3.dll", "tcl85.dll", "tk85.dll"]:
                        src = join(prefix, name)
                        if os.path.exists(src):
                            copyfile(src, join(bin_dir, name), symlink)
    
                    for d in sys.path:
                        if d.endswith("lib_pypy"):
                            break
                    else:
                        logger.fatal("Could not find lib_pypy in sys.path")
                        raise SystemExit(3)
                    logger.info("Copying lib_pypy")
                    copyfile(d, os.path.join(home_dir, "lib_pypy"), symlink)
    
        if os.path.splitext(os.path.basename(py_executable))[0] != EXPECTED_EXE:
            secondary_exe = os.path.join(os.path.dirname(py_executable), EXPECTED_EXE)
            py_executable_ext = os.path.splitext(py_executable)[1]
            if py_executable_ext.lower() == ".exe":
                # python2.4 gives an extension of '.4' :P
                secondary_exe += py_executable_ext
            if os.path.exists(secondary_exe):
                logger.warn(
                    "Not overwriting existing {} script {} (you must use {})".format(
                        EXPECTED_EXE, secondary_exe, py_executable
                    )
                )
            else:
                logger.notify("Also creating executable in %s", secondary_exe)
                shutil.copyfile(sys.executable, secondary_exe)
                make_exe(secondary_exe)
    
        if ".framework" in prefix:
            original_python = None
            if "Python.framework" in prefix or "Python3.framework" in prefix:
                logger.debug("MacOSX Python framework detected")
                # Make sure we use the embedded interpreter inside
                # the framework, even if sys.executable points to
                # the stub executable in ${sys.prefix}/bin
                # See http://groups.google.com/group/python-virtualenv/
                #                              browse_thread/thread/17cab2f85da75951
                original_python = os.path.join(prefix, "Resources/Python.app/Contents/MacOS/Python")
            if "EPD" in prefix:
                logger.debug("EPD framework detected")
                original_python = os.path.join(prefix, "bin/python")
            shutil.copy(original_python, py_executable)
    
            # Copy the framework's dylib into the virtual
            # environment
            virtual_lib = os.path.join(home_dir, ".Python")
    
            if os.path.exists(virtual_lib):
                os.unlink(virtual_lib)
            lib_name = "Python3" if "Python3.framework" in prefix else "Python"
            copyfile(os.path.join(prefix, lib_name), virtual_lib, symlink)
    
            # And then change the install_name of the copied python executable
            search = (
                "@executable_path/../../../../Python3" if "Python3.framework" in prefix else os.path.join(prefix, lib_name)
            )
            # noinspection PyBroadException
            try:
                mach_o_change(py_executable, search, "@executable_path/../.Python")
            except Exception:
                e = sys.exc_info()[1]
                logger.warn("Could not call mach_o_change: %s. " "Trying to call install_name_tool instead.", e)
                try:
                    call_subprocess(["install_name_tool", "-change", search, "@executable_path/../.Python", py_executable])
                except Exception:
                    logger.fatal("Could not call install_name_tool -- you must " "have Apple's development tools installed")
                    raise
    
        if not IS_WIN:
            # Ensure that 'python', 'pythonX' and 'pythonX.Y' all exist
            py_exe_version_major = "python{}".format(sys.version_info[0])
            py_exe_version_major_minor = "python{}.{}".format(sys.version_info[0], sys.version_info[1])
            py_exe_no_version = "python"
            required_symlinks = [py_exe_no_version, py_exe_version_major, py_exe_version_major_minor]
    
            py_executable_base = os.path.basename(py_executable)
    
            if py_executable_base in required_symlinks:
                # Don't try to symlink to yourself.
                required_symlinks.remove(py_executable_base)
    
            for pth in required_symlinks:
                full_pth = join(bin_dir, pth)
                if os.path.exists(full_pth):
                    os.unlink(full_pth)
                if symlink:
                    os.symlink(py_executable_base, full_pth)
                else:
                    copyfile(py_executable, full_pth, symlink)
    
        cmd = [
            py_executable,
            "-c",
            "import sys;out=sys.stdout;" 'getattr(out, "buffer", out).write(sys.prefix.encode("utf-8"))',
        ]
        logger.info('Testing executable with %s %s "%s"', *cmd)
        try:
            proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
            proc_stdout, proc_stderr = proc.communicate()
        except OSError:
            e = sys.exc_info()[1]
            if e.errno == errno.EACCES:
                logger.fatal("ERROR: The executable {} could not be run: {}".format(py_executable, e))
                sys.exit(100)
            else:
                raise e
    
        proc_stdout = proc_stdout.strip().decode("utf-8")
        # normalize paths using realpath to ensure that a virtualenv correctly identifies itself even
        # when addressed over a symlink
        proc_stdout = os.path.normcase(os.path.realpath(proc_stdout))
        norm_home_dir = os.path.normcase(os.path.realpath(home_dir))
        if hasattr(norm_home_dir, "decode"):
            norm_home_dir = norm_home_dir.decode(sys.getfilesystemencoding())
        if proc_stdout != norm_home_dir:
            logger.fatal("ERROR: The executable %s is not functioning", py_executable)
            logger.fatal("ERROR: It thinks sys.prefix is {!r} (should be {!r})".format(proc_stdout, norm_home_dir))
            logger.fatal("ERROR: virtualenv is not compatible with this system or executable")
            if IS_WIN:
                logger.fatal(
                    "Note: some Windows users have reported this error when they "
                    'installed Python for "Only this user" or have multiple '
                    "versions of Python installed. Copying the appropriate "
                    "PythonXX.dll to the virtualenv Scripts/ directory may fix "
                    "this problem."
                )
>           sys.exit(100)
E           SystemExit: 100
.tox\py\lib\site-packages\virtualenv.py:1708: SystemExit
---------------------------- Captured stdout setup ----------------------------
ERROR: The executable C:\Users\appveyor\AppData\Local\Temp\1\pytest-of-appveyor\pytest-0\popen-gw1\virtualenv0\venv_orig\Scripts\python.exe is not functioning
ERROR: It thinks sys.prefix is 'c:\\projects\\pip' (should be 'c:\\users\\appveyor\\appdata\\local\\temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\virtualenv0\\venv_orig')
ERROR: virtualenv is not compatible with this system or executable
Note: some Windows users have reported this error when they installed Python for "Only this user" or have multiple versions of Python installed. Copying the appropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem.
---------------------------- Captured stderr setup ----------------------------
No pyvenv.cfg file
________ ERROR at setup of test_build_env_overlay_prefix_has_priority _________
[gw0] win32 -- Python 3.8.0 c:\projects\pip\.tox\py\scripts\python.exe
request = <SubRequest 'virtualenv_template' for <Function 'test_build_env_overlay_prefix_has_priority'>>
tmpdir_factory = <_pytest.tmpdir.TempdirFactory object at 0x00000034F93792E0>
pip_src = Path('C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\pip_src0\\pip_src')
setuptools_install = Path('C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\setuptools0\\install')
common_wheels = Path('C:\\projects\\pip\\tests\\data\\common_wheels')
    @pytest.fixture(scope='session')
    def virtualenv_template(request, tmpdir_factory, pip_src,
                            setuptools_install, common_wheels):
    
        if six.PY3 and request.config.getoption('--use-venv'):
            venv_type = 'venv'
        else:
            venv_type = 'virtualenv'
    
        # Create the virtual environment
        tmpdir = Path(str(tmpdir_factory.mktemp('virtualenv')))
>       venv = VirtualEnvironment(
            tmpdir.joinpath("venv_orig"), venv_type=venv_type
        )
tests\conftest.py:243: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests\lib\venv.py:32: in __init__
    self._create()
tests\lib\venv.py:66: in _create
    _virtualenv.create_environment(
.tox\py\lib\site-packages\virtualenv.py:1158: in create_environment
    install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
home_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv1\\venv_orig'
lib_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv1\\venv_orig\\Lib'
inc_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv1\\venv_orig\\Include'
bin_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv1\\venv_orig\\Scripts'
site_packages = False, clear = False, symlink = True
    def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, symlink=True):
        """Install just the base environment, no distutils patches etc"""
        if sys.executable.startswith(bin_dir):
            print("Please use the *system* python to run this script")
            return
    
        if clear:
            rm_tree(lib_dir)
            # FIXME: why not delete it?
            # Maybe it should delete everything with #!/path/to/venv/python in it
            logger.notify("Not deleting %s", bin_dir)
    
        if hasattr(sys, "real_prefix"):
            logger.notify("Using real prefix %r", sys.real_prefix)
            prefix = sys.real_prefix
        elif hasattr(sys, "base_prefix"):
            logger.notify("Using base prefix %r", sys.base_prefix)
            prefix = sys.base_prefix
        else:
            prefix = sys.prefix
        prefix = os.path.abspath(prefix)
        mkdir(lib_dir)
        fix_lib64(lib_dir, symlink)
        stdlib_dirs = [os.path.dirname(os.__file__)]
        if IS_WIN:
            stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), "DLLs"))
        elif IS_DARWIN:
            stdlib_dirs.append(join(stdlib_dirs[0], "site-packages"))
        if hasattr(os, "symlink"):
            logger.info("Symlinking Python bootstrap modules")
        else:
            logger.info("Copying Python bootstrap modules")
        logger.indent += 2
        try:
            # copy required files...
            for stdlib_dir in stdlib_dirs:
                copy_required_files(stdlib_dir, lib_dir, symlink)
            # ...and modules
            copy_required_modules(home_dir, symlink)
            copy_license(prefix, home_dir, lib_dir, symlink)
        finally:
            logger.indent -= 2
        # ...copy tcl/tk
        if IS_WIN:
            copy_tcltk(prefix, home_dir, symlink)
        mkdir(join(lib_dir, "site-packages"))
        import site
    
        site_filename = site.__file__
        if site_filename.endswith(".pyc") or site_filename.endswith(".pyo"):
            site_filename = site_filename[:-1]
        elif site_filename.endswith("$py.class"):
            site_filename = site_filename.replace("$py.class", ".py")
        site_filename_dst = change_prefix(site_filename, home_dir)
        site_dir = os.path.dirname(site_filename_dst)
        writefile(site_filename_dst, SITE_PY)
        writefile(join(site_dir, "orig-prefix.txt"), prefix)
        site_packages_filename = join(site_dir, "no-global-site-packages.txt")
        if not site_packages:
            writefile(site_packages_filename, "")
    
        if IS_PYPY or IS_WIN:
            standard_lib_include_dir = join(prefix, "include")
        else:
            standard_lib_include_dir = join(prefix, "include", PY_VERSION + ABI_FLAGS)
        if os.path.exists(standard_lib_include_dir):
            copy_include_dir(standard_lib_include_dir, inc_dir, symlink)
        else:
            logger.debug("No include dir %s", standard_lib_include_dir)
    
        platform_include_dir = distutils.sysconfig.get_python_inc(plat_specific=1)
        if platform_include_dir != standard_lib_include_dir:
            platform_include_dest = distutils.sysconfig.get_python_inc(plat_specific=1, prefix=home_dir)
            if platform_include_dir == platform_include_dest:
                # Do platinc_dest manually due to a CPython bug;
                # not http://bugs.python.org/issue3386 but a close cousin
                platform_include_dest = subst_path(platform_include_dir, prefix, home_dir)
            if platform_include_dest:
                # PyPy's stdinc_dir and prefix are relative to the original binary
                # (traversing virtualenvs), whereas the platinc_dir is relative to
                # the inner virtualenv and ignores the prefix argument.
                # This seems more evolved than designed.
                copy_include_dir(platform_include_dir, platform_include_dest, symlink)
    
        # pypy never uses exec_prefix, just ignore it
        if os.path.realpath(sys.exec_prefix) != os.path.realpath(prefix) and not IS_PYPY:
            if IS_WIN:
                exec_dir = join(sys.exec_prefix, "lib")
            else:
                exec_dir = join(sys.exec_prefix, "lib", PY_VERSION)
            copy_required_files(exec_dir, lib_dir, symlink)
    
        mkdir(bin_dir)
        py_executable = join(bin_dir, os.path.basename(sys.executable))
        if "Python.framework" in prefix or "Python3.framework" in prefix:
            # OS X framework builds cause validation to break
            # https://github.com/pypa/virtualenv/issues/322
            if os.environ.get("__PYVENV_LAUNCHER__"):
                del os.environ["__PYVENV_LAUNCHER__"]
            if re.search(r"/Python(?:-32|-64)*$", py_executable):
                # The name of the python executable is not quite what
                # we want, rename it.
                py_executable = os.path.join(os.path.dirname(py_executable), "python")
    
        logger.notify("New %s executable in %s", EXPECTED_EXE, py_executable)
        pc_build_dir = os.path.dirname(sys.executable)
        pyd_pth = os.path.join(lib_dir, "site-packages", "virtualenv_builddir_pyd.pth")
        if IS_WIN and os.path.exists(os.path.join(pc_build_dir, "build.bat")):
            logger.notify("Detected python running from build directory %s", pc_build_dir)
            logger.notify("Writing .pth file linking to build directory for *.pyd files")
            writefile(pyd_pth, pc_build_dir)
        else:
            if os.path.exists(pyd_pth):
                logger.info("Deleting %s (not Windows env or not build directory python)", pyd_pth)
                os.unlink(pyd_pth)
    
        if sys.executable != py_executable:
            # FIXME: could I just hard link?
            executable = sys.executable
            shutil.copyfile(executable, py_executable)
            make_exe(py_executable)
            if IS_WIN or IS_CYGWIN:
                python_w = os.path.join(os.path.dirname(sys.executable), "pythonw.exe")
                if os.path.exists(python_w):
                    logger.info("Also created pythonw.exe")
                    shutil.copyfile(python_w, os.path.join(os.path.dirname(py_executable), "pythonw.exe"))
                python_d = os.path.join(os.path.dirname(sys.executable), "python_d.exe")
                python_d_dest = os.path.join(os.path.dirname(py_executable), "python_d.exe")
                if os.path.exists(python_d):
                    logger.info("Also created python_d.exe")
                    shutil.copyfile(python_d, python_d_dest)
                elif os.path.exists(python_d_dest):
                    logger.info("Removed python_d.exe as it is no longer at the source")
                    os.unlink(python_d_dest)
    
                # we need to copy the DLL to enforce that windows will load the correct one.
                # may not exist if we are cygwin.
                if IS_PYPY:
                    py_executable_dll_s = [("libpypy-c.dll", "libpypy_d-c.dll")]
                else:
                    py_executable_dll_s = [
                        ("python{}.dll".format(sys.version_info[0]), "python{}_d.dll".format(sys.version_info[0])),
                        (
                            "python{}{}.dll".format(sys.version_info[0], sys.version_info[1]),
                            "python{}{}_d.dll".format(sys.version_info[0], sys.version_info[1]),
                        ),
                    ]
    
                for py_executable_dll, py_executable_dll_d in py_executable_dll_s:
                    python_dll = os.path.join(os.path.dirname(sys.executable), py_executable_dll)
                    python_dll_d = os.path.join(os.path.dirname(sys.executable), py_executable_dll_d)
                    python_dll_d_dest = os.path.join(os.path.dirname(py_executable), py_executable_dll_d)
                    if os.path.exists(python_dll):
                        logger.info("Also created %s", py_executable_dll)
                        shutil.copyfile(python_dll, os.path.join(os.path.dirname(py_executable), py_executable_dll))
                    if os.path.exists(python_dll_d):
                        logger.info("Also created %s", py_executable_dll_d)
                        shutil.copyfile(python_dll_d, python_dll_d_dest)
                    elif os.path.exists(python_dll_d_dest):
                        logger.info("Removed %s as the source does not exist", python_dll_d_dest)
                        os.unlink(python_dll_d_dest)
            if IS_PYPY:
                # make a symlink python --> pypy-c
                python_executable = os.path.join(os.path.dirname(py_executable), "python")
                if IS_WIN or IS_CYGWIN:
                    python_executable += ".exe"
                logger.info("Also created executable %s", python_executable)
                copyfile(py_executable, python_executable, symlink)
    
                if IS_WIN:
                    for name in ["libexpat.dll", "libeay32.dll", "ssleay32.dll", "sqlite3.dll", "tcl85.dll", "tk85.dll"]:
                        src = join(prefix, name)
                        if os.path.exists(src):
                            copyfile(src, join(bin_dir, name), symlink)
    
                    for d in sys.path:
                        if d.endswith("lib_pypy"):
                            break
                    else:
                        logger.fatal("Could not find lib_pypy in sys.path")
                        raise SystemExit(3)
                    logger.info("Copying lib_pypy")
                    copyfile(d, os.path.join(home_dir, "lib_pypy"), symlink)
    
        if os.path.splitext(os.path.basename(py_executable))[0] != EXPECTED_EXE:
            secondary_exe = os.path.join(os.path.dirname(py_executable), EXPECTED_EXE)
            py_executable_ext = os.path.splitext(py_executable)[1]
            if py_executable_ext.lower() == ".exe":
                # python2.4 gives an extension of '.4' :P
                secondary_exe += py_executable_ext
            if os.path.exists(secondary_exe):
                logger.warn(
                    "Not overwriting existing {} script {} (you must use {})".format(
                        EXPECTED_EXE, secondary_exe, py_executable
                    )
                )
            else:
                logger.notify("Also creating executable in %s", secondary_exe)
                shutil.copyfile(sys.executable, secondary_exe)
                make_exe(secondary_exe)
    
        if ".framework" in prefix:
            original_python = None
            if "Python.framework" in prefix or "Python3.framework" in prefix:
                logger.debug("MacOSX Python framework detected")
                # Make sure we use the embedded interpreter inside
                # the framework, even if sys.executable points to
                # the stub executable in ${sys.prefix}/bin
                # See http://groups.google.com/group/python-virtualenv/
                #                              browse_thread/thread/17cab2f85da75951
                original_python = os.path.join(prefix, "Resources/Python.app/Contents/MacOS/Python")
            if "EPD" in prefix:
                logger.debug("EPD framework detected")
                original_python = os.path.join(prefix, "bin/python")
            shutil.copy(original_python, py_executable)
    
            # Copy the framework's dylib into the virtual
            # environment
            virtual_lib = os.path.join(home_dir, ".Python")
    
            if os.path.exists(virtual_lib):
                os.unlink(virtual_lib)
            lib_name = "Python3" if "Python3.framework" in prefix else "Python"
            copyfile(os.path.join(prefix, lib_name), virtual_lib, symlink)
    
            # And then change the install_name of the copied python executable
            search = (
                "@executable_path/../../../../Python3" if "Python3.framework" in prefix else os.path.join(prefix, lib_name)
            )
            # noinspection PyBroadException
            try:
                mach_o_change(py_executable, search, "@executable_path/../.Python")
            except Exception:
                e = sys.exc_info()[1]
                logger.warn("Could not call mach_o_change: %s. " "Trying to call install_name_tool instead.", e)
                try:
                    call_subprocess(["install_name_tool", "-change", search, "@executable_path/../.Python", py_executable])
                except Exception:
                    logger.fatal("Could not call install_name_tool -- you must " "have Apple's development tools installed")
                    raise
    
        if not IS_WIN:
            # Ensure that 'python', 'pythonX' and 'pythonX.Y' all exist
            py_exe_version_major = "python{}".format(sys.version_info[0])
            py_exe_version_major_minor = "python{}.{}".format(sys.version_info[0], sys.version_info[1])
            py_exe_no_version = "python"
            required_symlinks = [py_exe_no_version, py_exe_version_major, py_exe_version_major_minor]
    
            py_executable_base = os.path.basename(py_executable)
    
            if py_executable_base in required_symlinks:
                # Don't try to symlink to yourself.
                required_symlinks.remove(py_executable_base)
    
            for pth in required_symlinks:
                full_pth = join(bin_dir, pth)
                if os.path.exists(full_pth):
                    os.unlink(full_pth)
                if symlink:
                    os.symlink(py_executable_base, full_pth)
                else:
                    copyfile(py_executable, full_pth, symlink)
    
        cmd = [
            py_executable,
            "-c",
            "import sys;out=sys.stdout;" 'getattr(out, "buffer", out).write(sys.prefix.encode("utf-8"))',
        ]
        logger.info('Testing executable with %s %s "%s"', *cmd)
        try:
            proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
            proc_stdout, proc_stderr = proc.communicate()
        except OSError:
            e = sys.exc_info()[1]
            if e.errno == errno.EACCES:
                logger.fatal("ERROR: The executable {} could not be run: {}".format(py_executable, e))
                sys.exit(100)
            else:
                raise e
    
        proc_stdout = proc_stdout.strip().decode("utf-8")
        # normalize paths using realpath to ensure that a virtualenv correctly identifies itself even
        # when addressed over a symlink
        proc_stdout = os.path.normcase(os.path.realpath(proc_stdout))
        norm_home_dir = os.path.normcase(os.path.realpath(home_dir))
        if hasattr(norm_home_dir, "decode"):
            norm_home_dir = norm_home_dir.decode(sys.getfilesystemencoding())
        if proc_stdout != norm_home_dir:
            logger.fatal("ERROR: The executable %s is not functioning", py_executable)
            logger.fatal("ERROR: It thinks sys.prefix is {!r} (should be {!r})".format(proc_stdout, norm_home_dir))
            logger.fatal("ERROR: virtualenv is not compatible with this system or executable")
            if IS_WIN:
                logger.fatal(
                    "Note: some Windows users have reported this error when they "
                    'installed Python for "Only this user" or have multiple '
                    "versions of Python installed. Copying the appropriate "
                    "PythonXX.dll to the virtualenv Scripts/ directory may fix "
                    "this problem."
                )
>           sys.exit(100)
E           SystemExit: 100
.tox\py\lib\site-packages\virtualenv.py:1708: SystemExit
---------------------------- Captured stdout setup ----------------------------
ERROR: The executable C:\Users\appveyor\AppData\Local\Temp\1\pytest-of-appveyor\pytest-0\popen-gw0\virtualenv1\venv_orig\Scripts\python.exe is not functioning
ERROR: It thinks sys.prefix is 'c:\\projects\\pip' (should be 'c:\\users\\appveyor\\appdata\\local\\temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv1\\venv_orig')
ERROR: virtualenv is not compatible with this system or executable
Note: some Windows users have reported this error when they installed Python for "Only this user" or have multiple versions of Python installed. Copying the appropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem.
---------------------------- Captured stderr setup ----------------------------
No pyvenv.cfg file
_________________ ERROR at setup of test_build_env_isolation __________________
[gw1] win32 -- Python 3.8.0 c:\projects\pip\.tox\py\scripts\python.exe
request = <SubRequest 'virtualenv_template' for <Function 'test_build_env_isolation'>>
tmpdir_factory = <_pytest.tmpdir.TempdirFactory object at 0x00000031FCB992E0>
pip_src = Path('C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\pip_src0\\pip_src')
setuptools_install = Path('C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\setuptools0\\install')
common_wheels = Path('C:\\projects\\pip\\tests\\data\\common_wheels')
    @pytest.fixture(scope='session')
    def virtualenv_template(request, tmpdir_factory, pip_src,
                            setuptools_install, common_wheels):
    
        if six.PY3 and request.config.getoption('--use-venv'):
            venv_type = 'venv'
        else:
            venv_type = 'virtualenv'
    
        # Create the virtual environment
        tmpdir = Path(str(tmpdir_factory.mktemp('virtualenv')))
>       venv = VirtualEnvironment(
            tmpdir.joinpath("venv_orig"), venv_type=venv_type
        )
tests\conftest.py:243: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests\lib\venv.py:32: in __init__
    self._create()
tests\lib\venv.py:66: in _create
    _virtualenv.create_environment(
.tox\py\lib\site-packages\virtualenv.py:1158: in create_environment
    install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
home_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\virtualenv1\\venv_orig'
lib_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\virtualenv1\\venv_orig\\Lib'
inc_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\virtualenv1\\venv_orig\\Include'
bin_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\virtualenv1\\venv_orig\\Scripts'
site_packages = False, clear = False, symlink = True
    def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, symlink=True):
        """Install just the base environment, no distutils patches etc"""
        if sys.executable.startswith(bin_dir):
            print("Please use the *system* python to run this script")
            return
    
        if clear:
            rm_tree(lib_dir)
            # FIXME: why not delete it?
            # Maybe it should delete everything with #!/path/to/venv/python in it
            logger.notify("Not deleting %s", bin_dir)
    
        if hasattr(sys, "real_prefix"):
            logger.notify("Using real prefix %r", sys.real_prefix)
            prefix = sys.real_prefix
        elif hasattr(sys, "base_prefix"):
            logger.notify("Using base prefix %r", sys.base_prefix)
            prefix = sys.base_prefix
        else:
            prefix = sys.prefix
        prefix = os.path.abspath(prefix)
        mkdir(lib_dir)
        fix_lib64(lib_dir, symlink)
        stdlib_dirs = [os.path.dirname(os.__file__)]
        if IS_WIN:
            stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), "DLLs"))
        elif IS_DARWIN:
            stdlib_dirs.append(join(stdlib_dirs[0], "site-packages"))
        if hasattr(os, "symlink"):
            logger.info("Symlinking Python bootstrap modules")
        else:
            logger.info("Copying Python bootstrap modules")
        logger.indent += 2
        try:
            # copy required files...
            for stdlib_dir in stdlib_dirs:
                copy_required_files(stdlib_dir, lib_dir, symlink)
            # ...and modules
            copy_required_modules(home_dir, symlink)
            copy_license(prefix, home_dir, lib_dir, symlink)
        finally:
            logger.indent -= 2
        # ...copy tcl/tk
        if IS_WIN:
            copy_tcltk(prefix, home_dir, symlink)
        mkdir(join(lib_dir, "site-packages"))
        import site
    
        site_filename = site.__file__
        if site_filename.endswith(".pyc") or site_filename.endswith(".pyo"):
            site_filename = site_filename[:-1]
        elif site_filename.endswith("$py.class"):
            site_filename = site_filename.replace("$py.class", ".py")
        site_filename_dst = change_prefix(site_filename, home_dir)
        site_dir = os.path.dirname(site_filename_dst)
        writefile(site_filename_dst, SITE_PY)
        writefile(join(site_dir, "orig-prefix.txt"), prefix)
        site_packages_filename = join(site_dir, "no-global-site-packages.txt")
        if not site_packages:
            writefile(site_packages_filename, "")
    
        if IS_PYPY or IS_WIN:
            standard_lib_include_dir = join(prefix, "include")
        else:
            standard_lib_include_dir = join(prefix, "include", PY_VERSION + ABI_FLAGS)
        if os.path.exists(standard_lib_include_dir):
            copy_include_dir(standard_lib_include_dir, inc_dir, symlink)
        else:
            logger.debug("No include dir %s", standard_lib_include_dir)
    
        platform_include_dir = distutils.sysconfig.get_python_inc(plat_specific=1)
        if platform_include_dir != standard_lib_include_dir:
            platform_include_dest = distutils.sysconfig.get_python_inc(plat_specific=1, prefix=home_dir)
            if platform_include_dir == platform_include_dest:
                # Do platinc_dest manually due to a CPython bug;
                # not http://bugs.python.org/issue3386 but a close cousin
                platform_include_dest = subst_path(platform_include_dir, prefix, home_dir)
            if platform_include_dest:
                # PyPy's stdinc_dir and prefix are relative to the original binary
                # (traversing virtualenvs), whereas the platinc_dir is relative to
                # the inner virtualenv and ignores the prefix argument.
                # This seems more evolved than designed.
                copy_include_dir(platform_include_dir, platform_include_dest, symlink)
    
        # pypy never uses exec_prefix, just ignore it
        if os.path.realpath(sys.exec_prefix) != os.path.realpath(prefix) and not IS_PYPY:
            if IS_WIN:
                exec_dir = join(sys.exec_prefix, "lib")
            else:
                exec_dir = join(sys.exec_prefix, "lib", PY_VERSION)
            copy_required_files(exec_dir, lib_dir, symlink)
    
        mkdir(bin_dir)
        py_executable = join(bin_dir, os.path.basename(sys.executable))
        if "Python.framework" in prefix or "Python3.framework" in prefix:
            # OS X framework builds cause validation to break
            # https://github.com/pypa/virtualenv/issues/322
            if os.environ.get("__PYVENV_LAUNCHER__"):
                del os.environ["__PYVENV_LAUNCHER__"]
            if re.search(r"/Python(?:-32|-64)*$", py_executable):
                # The name of the python executable is not quite what
                # we want, rename it.
                py_executable = os.path.join(os.path.dirname(py_executable), "python")
    
        logger.notify("New %s executable in %s", EXPECTED_EXE, py_executable)
        pc_build_dir = os.path.dirname(sys.executable)
        pyd_pth = os.path.join(lib_dir, "site-packages", "virtualenv_builddir_pyd.pth")
        if IS_WIN and os.path.exists(os.path.join(pc_build_dir, "build.bat")):
            logger.notify("Detected python running from build directory %s", pc_build_dir)
            logger.notify("Writing .pth file linking to build directory for *.pyd files")
            writefile(pyd_pth, pc_build_dir)
        else:
            if os.path.exists(pyd_pth):
                logger.info("Deleting %s (not Windows env or not build directory python)", pyd_pth)
                os.unlink(pyd_pth)
    
        if sys.executable != py_executable:
            # FIXME: could I just hard link?
            executable = sys.executable
            shutil.copyfile(executable, py_executable)
            make_exe(py_executable)
            if IS_WIN or IS_CYGWIN:
                python_w = os.path.join(os.path.dirname(sys.executable), "pythonw.exe")
                if os.path.exists(python_w):
                    logger.info("Also created pythonw.exe")
                    shutil.copyfile(python_w, os.path.join(os.path.dirname(py_executable), "pythonw.exe"))
                python_d = os.path.join(os.path.dirname(sys.executable), "python_d.exe")
                python_d_dest = os.path.join(os.path.dirname(py_executable), "python_d.exe")
                if os.path.exists(python_d):
                    logger.info("Also created python_d.exe")
                    shutil.copyfile(python_d, python_d_dest)
                elif os.path.exists(python_d_dest):
                    logger.info("Removed python_d.exe as it is no longer at the source")
                    os.unlink(python_d_dest)
    
                # we need to copy the DLL to enforce that windows will load the correct one.
                # may not exist if we are cygwin.
                if IS_PYPY:
                    py_executable_dll_s = [("libpypy-c.dll", "libpypy_d-c.dll")]
                else:
                    py_executable_dll_s = [
                        ("python{}.dll".format(sys.version_info[0]), "python{}_d.dll".format(sys.version_info[0])),
                        (
                            "python{}{}.dll".format(sys.version_info[0], sys.version_info[1]),
                            "python{}{}_d.dll".format(sys.version_info[0], sys.version_info[1]),
                        ),
                    ]
    
                for py_executable_dll, py_executable_dll_d in py_executable_dll_s:
                    python_dll = os.path.join(os.path.dirname(sys.executable), py_executable_dll)
                    python_dll_d = os.path.join(os.path.dirname(sys.executable), py_executable_dll_d)
                    python_dll_d_dest = os.path.join(os.path.dirname(py_executable), py_executable_dll_d)
                    if os.path.exists(python_dll):
                        logger.info("Also created %s", py_executable_dll)
                        shutil.copyfile(python_dll, os.path.join(os.path.dirname(py_executable), py_executable_dll))
                    if os.path.exists(python_dll_d):
                        logger.info("Also created %s", py_executable_dll_d)
                        shutil.copyfile(python_dll_d, python_dll_d_dest)
                    elif os.path.exists(python_dll_d_dest):
                        logger.info("Removed %s as the source does not exist", python_dll_d_dest)
                        os.unlink(python_dll_d_dest)
            if IS_PYPY:
                # make a symlink python --> pypy-c
                python_executable = os.path.join(os.path.dirname(py_executable), "python")
                if IS_WIN or IS_CYGWIN:
                    python_executable += ".exe"
                logger.info("Also created executable %s", python_executable)
                copyfile(py_executable, python_executable, symlink)
    
                if IS_WIN:
                    for name in ["libexpat.dll", "libeay32.dll", "ssleay32.dll", "sqlite3.dll", "tcl85.dll", "tk85.dll"]:
                        src = join(prefix, name)
                        if os.path.exists(src):
                            copyfile(src, join(bin_dir, name), symlink)
    
                    for d in sys.path:
                        if d.endswith("lib_pypy"):
                            break
                    else:
                        logger.fatal("Could not find lib_pypy in sys.path")
                        raise SystemExit(3)
                    logger.info("Copying lib_pypy")
                    copyfile(d, os.path.join(home_dir, "lib_pypy"), symlink)
    
        if os.path.splitext(os.path.basename(py_executable))[0] != EXPECTED_EXE:
            secondary_exe = os.path.join(os.path.dirname(py_executable), EXPECTED_EXE)
            py_executable_ext = os.path.splitext(py_executable)[1]
            if py_executable_ext.lower() == ".exe":
                # python2.4 gives an extension of '.4' :P
                secondary_exe += py_executable_ext
            if os.path.exists(secondary_exe):
                logger.warn(
                    "Not overwriting existing {} script {} (you must use {})".format(
                        EXPECTED_EXE, secondary_exe, py_executable
                    )
                )
            else:
                logger.notify("Also creating executable in %s", secondary_exe)
                shutil.copyfile(sys.executable, secondary_exe)
                make_exe(secondary_exe)
    
        if ".framework" in prefix:
            original_python = None
            if "Python.framework" in prefix or "Python3.framework" in prefix:
                logger.debug("MacOSX Python framework detected")
                # Make sure we use the embedded interpreter inside
                # the framework, even if sys.executable points to
                # the stub executable in ${sys.prefix}/bin
                # See http://groups.google.com/group/python-virtualenv/
                #                              browse_thread/thread/17cab2f85da75951
                original_python = os.path.join(prefix, "Resources/Python.app/Contents/MacOS/Python")
            if "EPD" in prefix:
                logger.debug("EPD framework detected")
                original_python = os.path.join(prefix, "bin/python")
            shutil.copy(original_python, py_executable)
    
            # Copy the framework's dylib into the virtual
            # environment
            virtual_lib = os.path.join(home_dir, ".Python")
    
            if os.path.exists(virtual_lib):
                os.unlink(virtual_lib)
            lib_name = "Python3" if "Python3.framework" in prefix else "Python"
            copyfile(os.path.join(prefix, lib_name), virtual_lib, symlink)
    
            # And then change the install_name of the copied python executable
            search = (
                "@executable_path/../../../../Python3" if "Python3.framework" in prefix else os.path.join(prefix, lib_name)
            )
            # noinspection PyBroadException
            try:
                mach_o_change(py_executable, search, "@executable_path/../.Python")
            except Exception:
                e = sys.exc_info()[1]
                logger.warn("Could not call mach_o_change: %s. " "Trying to call install_name_tool instead.", e)
                try:
                    call_subprocess(["install_name_tool", "-change", search, "@executable_path/../.Python", py_executable])
                except Exception:
                    logger.fatal("Could not call install_name_tool -- you must " "have Apple's development tools installed")
                    raise
    
        if not IS_WIN:
            # Ensure that 'python', 'pythonX' and 'pythonX.Y' all exist
            py_exe_version_major = "python{}".format(sys.version_info[0])
            py_exe_version_major_minor = "python{}.{}".format(sys.version_info[0], sys.version_info[1])
            py_exe_no_version = "python"
            required_symlinks = [py_exe_no_version, py_exe_version_major, py_exe_version_major_minor]
    
            py_executable_base = os.path.basename(py_executable)
    
            if py_executable_base in required_symlinks:
                # Don't try to symlink to yourself.
                required_symlinks.remove(py_executable_base)
    
            for pth in required_symlinks:
                full_pth = join(bin_dir, pth)
                if os.path.exists(full_pth):
                    os.unlink(full_pth)
                if symlink:
                    os.symlink(py_executable_base, full_pth)
                else:
                    copyfile(py_executable, full_pth, symlink)
    
        cmd = [
            py_executable,
            "-c",
            "import sys;out=sys.stdout;" 'getattr(out, "buffer", out).write(sys.prefix.encode("utf-8"))',
        ]
        logger.info('Testing executable with %s %s "%s"', *cmd)
        try:
            proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
            proc_stdout, proc_stderr = proc.communicate()
        except OSError:
            e = sys.exc_info()[1]
            if e.errno == errno.EACCES:
                logger.fatal("ERROR: The executable {} could not be run: {}".format(py_executable, e))
                sys.exit(100)
            else:
                raise e
    
        proc_stdout = proc_stdout.strip().decode("utf-8")
        # normalize paths using realpath to ensure that a virtualenv correctly identifies itself even
        # when addressed over a symlink
        proc_stdout = os.path.normcase(os.path.realpath(proc_stdout))
        norm_home_dir = os.path.normcase(os.path.realpath(home_dir))
        if hasattr(norm_home_dir, "decode"):
            norm_home_dir = norm_home_dir.decode(sys.getfilesystemencoding())
        if proc_stdout != norm_home_dir:
            logger.fatal("ERROR: The executable %s is not functioning", py_executable)
            logger.fatal("ERROR: It thinks sys.prefix is {!r} (should be {!r})".format(proc_stdout, norm_home_dir))
            logger.fatal("ERROR: virtualenv is not compatible with this system or executable")
            if IS_WIN:
                logger.fatal(
                    "Note: some Windows users have reported this error when they "
                    'installed Python for "Only this user" or have multiple '
                    "versions of Python installed. Copying the appropriate "
                    "PythonXX.dll to the virtualenv Scripts/ directory may fix "
                    "this problem."
                )
>           sys.exit(100)
E           SystemExit: 100
.tox\py\lib\site-packages\virtualenv.py:1708: SystemExit
---------------------------- Captured stdout setup ----------------------------
ERROR: The executable C:\Users\appveyor\AppData\Local\Temp\1\pytest-of-appveyor\pytest-0\popen-gw1\virtualenv1\venv_orig\Scripts\python.exe is not functioning
ERROR: It thinks sys.prefix is 'c:\\projects\\pip' (should be 'c:\\users\\appveyor\\appdata\\local\\temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw1\\virtualenv1\\venv_orig')
ERROR: virtualenv is not compatible with this system or executable
Note: some Windows users have reported this error when they installed Python for "Only this user" or have multiple versions of Python installed. Copying the appropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem.
---------------------------- Captured stderr setup ----------------------------
No pyvenv.cfg file
_________________ ERROR at setup of test_should_cache_git_sha _________________
[gw0] win32 -- Python 3.8.0 c:\projects\pip\.tox\py\scripts\python.exe
request = <SubRequest 'virtualenv_template' for <Function 'test_should_cache_git_sha'>>
tmpdir_factory = <_pytest.tmpdir.TempdirFactory object at 0x00000034F93792E0>
pip_src = Path('C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\pip_src0\\pip_src')
setuptools_install = Path('C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\setuptools0\\install')
common_wheels = Path('C:\\projects\\pip\\tests\\data\\common_wheels')
    @pytest.fixture(scope='session')
    def virtualenv_template(request, tmpdir_factory, pip_src,
                            setuptools_install, common_wheels):
    
        if six.PY3 and request.config.getoption('--use-venv'):
            venv_type = 'venv'
        else:
            venv_type = 'virtualenv'
    
        # Create the virtual environment
        tmpdir = Path(str(tmpdir_factory.mktemp('virtualenv')))
>       venv = VirtualEnvironment(
            tmpdir.joinpath("venv_orig"), venv_type=venv_type
        )
tests\conftest.py:243: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests\lib\venv.py:32: in __init__
    self._create()
tests\lib\venv.py:66: in _create
    _virtualenv.create_environment(
.tox\py\lib\site-packages\virtualenv.py:1158: in create_environment
    install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
home_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv2\\venv_orig'
lib_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv2\\venv_orig\\Lib'
inc_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv2\\venv_orig\\Include'
bin_dir = 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv2\\venv_orig\\Scripts'
site_packages = False, clear = False, symlink = True
    def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, symlink=True):
        """Install just the base environment, no distutils patches etc"""
        if sys.executable.startswith(bin_dir):
            print("Please use the *system* python to run this script")
            return
    
        if clear:
            rm_tree(lib_dir)
            # FIXME: why not delete it?
            # Maybe it should delete everything with #!/path/to/venv/python in it
            logger.notify("Not deleting %s", bin_dir)
    
        if hasattr(sys, "real_prefix"):
            logger.notify("Using real prefix %r", sys.real_prefix)
            prefix = sys.real_prefix
        elif hasattr(sys, "base_prefix"):
            logger.notify("Using base prefix %r", sys.base_prefix)
            prefix = sys.base_prefix
        else:
            prefix = sys.prefix
        prefix = os.path.abspath(prefix)
        mkdir(lib_dir)
        fix_lib64(lib_dir, symlink)
        stdlib_dirs = [os.path.dirname(os.__file__)]
        if IS_WIN:
            stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), "DLLs"))
        elif IS_DARWIN:
            stdlib_dirs.append(join(stdlib_dirs[0], "site-packages"))
        if hasattr(os, "symlink"):
            logger.info("Symlinking Python bootstrap modules")
        else:
            logger.info("Copying Python bootstrap modules")
        logger.indent += 2
        try:
            # copy required files...
            for stdlib_dir in stdlib_dirs:
                copy_required_files(stdlib_dir, lib_dir, symlink)
            # ...and modules
            copy_required_modules(home_dir, symlink)
            copy_license(prefix, home_dir, lib_dir, symlink)
        finally:
            logger.indent -= 2
        # ...copy tcl/tk
        if IS_WIN:
            copy_tcltk(prefix, home_dir, symlink)
        mkdir(join(lib_dir, "site-packages"))
        import site
    
        site_filename = site.__file__
        if site_filename.endswith(".pyc") or site_filename.endswith(".pyo"):
            site_filename = site_filename[:-1]
        elif site_filename.endswith("$py.class"):
            site_filename = site_filename.replace("$py.class", ".py")
        site_filename_dst = change_prefix(site_filename, home_dir)
        site_dir = os.path.dirname(site_filename_dst)
        writefile(site_filename_dst, SITE_PY)
        writefile(join(site_dir, "orig-prefix.txt"), prefix)
        site_packages_filename = join(site_dir, "no-global-site-packages.txt")
        if not site_packages:
            writefile(site_packages_filename, "")
    
        if IS_PYPY or IS_WIN:
            standard_lib_include_dir = join(prefix, "include")
        else:
            standard_lib_include_dir = join(prefix, "include", PY_VERSION + ABI_FLAGS)
        if os.path.exists(standard_lib_include_dir):
            copy_include_dir(standard_lib_include_dir, inc_dir, symlink)
        else:
            logger.debug("No include dir %s", standard_lib_include_dir)
    
        platform_include_dir = distutils.sysconfig.get_python_inc(plat_specific=1)
        if platform_include_dir != standard_lib_include_dir:
            platform_include_dest = distutils.sysconfig.get_python_inc(plat_specific=1, prefix=home_dir)
            if platform_include_dir == platform_include_dest:
                # Do platinc_dest manually due to a CPython bug;
                # not http://bugs.python.org/issue3386 but a close cousin
                platform_include_dest = subst_path(platform_include_dir, prefix, home_dir)
            if platform_include_dest:
                # PyPy's stdinc_dir and prefix are relative to the original binary
                # (traversing virtualenvs), whereas the platinc_dir is relative to
                # the inner virtualenv and ignores the prefix argument.
                # This seems more evolved than designed.
                copy_include_dir(platform_include_dir, platform_include_dest, symlink)
    
        # pypy never uses exec_prefix, just ignore it
        if os.path.realpath(sys.exec_prefix) != os.path.realpath(prefix) and not IS_PYPY:
            if IS_WIN:
                exec_dir = join(sys.exec_prefix, "lib")
            else:
                exec_dir = join(sys.exec_prefix, "lib", PY_VERSION)
            copy_required_files(exec_dir, lib_dir, symlink)
    
        mkdir(bin_dir)
        py_executable = join(bin_dir, os.path.basename(sys.executable))
        if "Python.framework" in prefix or "Python3.framework" in prefix:
            # OS X framework builds cause validation to break
            # https://github.com/pypa/virtualenv/issues/322
            if os.environ.get("__PYVENV_LAUNCHER__"):
                del os.environ["__PYVENV_LAUNCHER__"]
            if re.search(r"/Python(?:-32|-64)*$", py_executable):
                # The name of the python executable is not quite what
                # we want, rename it.
                py_executable = os.path.join(os.path.dirname(py_executable), "python")
    
        logger.notify("New %s executable in %s", EXPECTED_EXE, py_executable)
        pc_build_dir = os.path.dirname(sys.executable)
        pyd_pth = os.path.join(lib_dir, "site-packages", "virtualenv_builddir_pyd.pth")
        if IS_WIN and os.path.exists(os.path.join(pc_build_dir, "build.bat")):
            logger.notify("Detected python running from build directory %s", pc_build_dir)
            logger.notify("Writing .pth file linking to build directory for *.pyd files")
            writefile(pyd_pth, pc_build_dir)
        else:
            if os.path.exists(pyd_pth):
                logger.info("Deleting %s (not Windows env or not build directory python)", pyd_pth)
                os.unlink(pyd_pth)
    
        if sys.executable != py_executable:
            # FIXME: could I just hard link?
            executable = sys.executable
            shutil.copyfile(executable, py_executable)
            make_exe(py_executable)
            if IS_WIN or IS_CYGWIN:
                python_w = os.path.join(os.path.dirname(sys.executable), "pythonw.exe")
                if os.path.exists(python_w):
                    logger.info("Also created pythonw.exe")
                    shutil.copyfile(python_w, os.path.join(os.path.dirname(py_executable), "pythonw.exe"))
                python_d = os.path.join(os.path.dirname(sys.executable), "python_d.exe")
                python_d_dest = os.path.join(os.path.dirname(py_executable), "python_d.exe")
                if os.path.exists(python_d):
                    logger.info("Also created python_d.exe")
                    shutil.copyfile(python_d, python_d_dest)
                elif os.path.exists(python_d_dest):
                    logger.info("Removed python_d.exe as it is no longer at the source")
                    os.unlink(python_d_dest)
    
                # we need to copy the DLL to enforce that windows will load the correct one.
                # may not exist if we are cygwin.
                if IS_PYPY:
                    py_executable_dll_s = [("libpypy-c.dll", "libpypy_d-c.dll")]
                else:
                    py_executable_dll_s = [
                        ("python{}.dll".format(sys.version_info[0]), "python{}_d.dll".format(sys.version_info[0])),
                        (
                            "python{}{}.dll".format(sys.version_info[0], sys.version_info[1]),
                            "python{}{}_d.dll".format(sys.version_info[0], sys.version_info[1]),
                        ),
                    ]
    
                for py_executable_dll, py_executable_dll_d in py_executable_dll_s:
                    python_dll = os.path.join(os.path.dirname(sys.executable), py_executable_dll)
                    python_dll_d = os.path.join(os.path.dirname(sys.executable), py_executable_dll_d)
                    python_dll_d_dest = os.path.join(os.path.dirname(py_executable), py_executable_dll_d)
                    if os.path.exists(python_dll):
                        logger.info("Also created %s", py_executable_dll)
                        shutil.copyfile(python_dll, os.path.join(os.path.dirname(py_executable), py_executable_dll))
                    if os.path.exists(python_dll_d):
                        logger.info("Also created %s", py_executable_dll_d)
                        shutil.copyfile(python_dll_d, python_dll_d_dest)
                    elif os.path.exists(python_dll_d_dest):
                        logger.info("Removed %s as the source does not exist", python_dll_d_dest)
                        os.unlink(python_dll_d_dest)
            if IS_PYPY:
                # make a symlink python --> pypy-c
                python_executable = os.path.join(os.path.dirname(py_executable), "python")
                if IS_WIN or IS_CYGWIN:
                    python_executable += ".exe"
                logger.info("Also created executable %s", python_executable)
                copyfile(py_executable, python_executable, symlink)
    
                if IS_WIN:
                    for name in ["libexpat.dll", "libeay32.dll", "ssleay32.dll", "sqlite3.dll", "tcl85.dll", "tk85.dll"]:
                        src = join(prefix, name)
                        if os.path.exists(src):
                            copyfile(src, join(bin_dir, name), symlink)
    
                    for d in sys.path:
                        if d.endswith("lib_pypy"):
                            break
                    else:
                        logger.fatal("Could not find lib_pypy in sys.path")
                        raise SystemExit(3)
                    logger.info("Copying lib_pypy")
                    copyfile(d, os.path.join(home_dir, "lib_pypy"), symlink)
    
        if os.path.splitext(os.path.basename(py_executable))[0] != EXPECTED_EXE:
            secondary_exe = os.path.join(os.path.dirname(py_executable), EXPECTED_EXE)
            py_executable_ext = os.path.splitext(py_executable)[1]
            if py_executable_ext.lower() == ".exe":
                # python2.4 gives an extension of '.4' :P
                secondary_exe += py_executable_ext
            if os.path.exists(secondary_exe):
                logger.warn(
                    "Not overwriting existing {} script {} (you must use {})".format(
                        EXPECTED_EXE, secondary_exe, py_executable
                    )
                )
            else:
                logger.notify("Also creating executable in %s", secondary_exe)
                shutil.copyfile(sys.executable, secondary_exe)
                make_exe(secondary_exe)
    
        if ".framework" in prefix:
            original_python = None
            if "Python.framework" in prefix or "Python3.framework" in prefix:
                logger.debug("MacOSX Python framework detected")
                # Make sure we use the embedded interpreter inside
                # the framework, even if sys.executable points to
                # the stub executable in ${sys.prefix}/bin
                # See http://groups.google.com/group/python-virtualenv/
                #                              browse_thread/thread/17cab2f85da75951
                original_python = os.path.join(prefix, "Resources/Python.app/Contents/MacOS/Python")
            if "EPD" in prefix:
                logger.debug("EPD framework detected")
                original_python = os.path.join(prefix, "bin/python")
            shutil.copy(original_python, py_executable)
    
            # Copy the framework's dylib into the virtual
            # environment
            virtual_lib = os.path.join(home_dir, ".Python")
    
            if os.path.exists(virtual_lib):
                os.unlink(virtual_lib)
            lib_name = "Python3" if "Python3.framework" in prefix else "Python"
            copyfile(os.path.join(prefix, lib_name), virtual_lib, symlink)
    
            # And then change the install_name of the copied python executable
            search = (
                "@executable_path/../../../../Python3" if "Python3.framework" in prefix else os.path.join(prefix, lib_name)
            )
            # noinspection PyBroadException
            try:
                mach_o_change(py_executable, search, "@executable_path/../.Python")
            except Exception:
                e = sys.exc_info()[1]
                logger.warn("Could not call mach_o_change: %s. " "Trying to call install_name_tool instead.", e)
                try:
                    call_subprocess(["install_name_tool", "-change", search, "@executable_path/../.Python", py_executable])
                except Exception:
                    logger.fatal("Could not call install_name_tool -- you must " "have Apple's development tools installed")
                    raise
    
        if not IS_WIN:
            # Ensure that 'python', 'pythonX' and 'pythonX.Y' all exist
            py_exe_version_major = "python{}".format(sys.version_info[0])
            py_exe_version_major_minor = "python{}.{}".format(sys.version_info[0], sys.version_info[1])
            py_exe_no_version = "python"
            required_symlinks = [py_exe_no_version, py_exe_version_major, py_exe_version_major_minor]
    
            py_executable_base = os.path.basename(py_executable)
    
            if py_executable_base in required_symlinks:
                # Don't try to symlink to yourself.
                required_symlinks.remove(py_executable_base)
    
            for pth in required_symlinks:
                full_pth = join(bin_dir, pth)
                if os.path.exists(full_pth):
                    os.unlink(full_pth)
                if symlink:
                    os.symlink(py_executable_base, full_pth)
                else:
                    copyfile(py_executable, full_pth, symlink)
    
        cmd = [
            py_executable,
            "-c",
            "import sys;out=sys.stdout;" 'getattr(out, "buffer", out).write(sys.prefix.encode("utf-8"))',
        ]
        logger.info('Testing executable with %s %s "%s"', *cmd)
        try:
            proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
            proc_stdout, proc_stderr = proc.communicate()
        except OSError:
            e = sys.exc_info()[1]
            if e.errno == errno.EACCES:
                logger.fatal("ERROR: The executable {} could not be run: {}".format(py_executable, e))
                sys.exit(100)
            else:
                raise e
    
        proc_stdout = proc_stdout.strip().decode("utf-8")
        # normalize paths using realpath to ensure that a virtualenv correctly identifies itself even
        # when addressed over a symlink
        proc_stdout = os.path.normcase(os.path.realpath(proc_stdout))
        norm_home_dir = os.path.normcase(os.path.realpath(home_dir))
        if hasattr(norm_home_dir, "decode"):
            norm_home_dir = norm_home_dir.decode(sys.getfilesystemencoding())
        if proc_stdout != norm_home_dir:
            logger.fatal("ERROR: The executable %s is not functioning", py_executable)
            logger.fatal("ERROR: It thinks sys.prefix is {!r} (should be {!r})".format(proc_stdout, norm_home_dir))
            logger.fatal("ERROR: virtualenv is not compatible with this system or executable")
            if IS_WIN:
                logger.fatal(
                    "Note: some Windows users have reported this error when they "
                    'installed Python for "Only this user" or have multiple '
                    "versions of Python installed. Copying the appropriate "
                    "PythonXX.dll to the virtualenv Scripts/ directory may fix "
                    "this problem."
                )
>           sys.exit(100)
E           SystemExit: 100
.tox\py\lib\site-packages\virtualenv.py:1708: SystemExit
---------------------------- Captured stdout setup ----------------------------
ERROR: The executable C:\Users\appveyor\AppData\Local\Temp\1\pytest-of-appveyor\pytest-0\popen-gw0\virtualenv2\venv_orig\Scripts\python.exe is not functioning
ERROR: It thinks sys.prefix is 'c:\\projects\\pip' (should be 'c:\\users\\appveyor\\appdata\\local\\temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv2\\venv_orig')
ERROR: virtualenv is not compatible with this system or executable
Note: some Windows users have reported this error when they installed Python for "Only this user" or have multiple versions of Python installed. Copying the appropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem.
---------------------------- Captured stderr setup ----------------------------
No pyvenv.cfg file
================================== FAILURES ===================================
_________________ test_expanduser[/Users/test-~-/Users/test] __________________
[gw1] win32 -- Python 3.8.0 c:\projects\pip\.tox\py\scripts\python.exe
home = '/Users/test', path = '~', expanded = '/Users/test'
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x00000031FCD8F910>
    @pytest.mark.parametrize("home,path,expanded", [
        ("/Users/test", "~", "/Users/test"),
        ("/Users/test", "~/.cache", "/Users/test/.cache"),
        # Verify that we are not affected by https://bugs.python.org/issue14768
        ("/", "~", "/"),
        ("/", "~/.cache", "/.cache"),
    ])
    def test_expanduser(home, path, expanded, monkeypatch):
        monkeypatch.setenv("HOME", home)
>       assert expanduser(path) == expanded
E       AssertionError: assert 'C:\\Users\\a...est___0\\home' == '/Users/test'
E         - C:\Users\appveyor\AppData\Local\Temp\1\pytest-of-appveyor\pytest-0\popen-gw1\test_expanduser__Users_test___0\home
E         + /Users/test
tests\unit\test_compat.py:147: AssertionError
___________________________ test_expanduser[/-~-/] ____________________________
[gw1] win32 -- Python 3.8.0 c:\projects\pip\.tox\py\scripts\python.exe
home = '/', path = '~', expanded = '/'
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x00000031FD0690A0>
    @pytest.mark.parametrize("home,path,expanded", [
        ("/Users/test", "~", "/Users/test"),
        ("/Users/test", "~/.cache", "/Users/test/.cache"),
        # Verify that we are not affected by https://bugs.python.org/issue14768
        ("/", "~", "/"),
        ("/", "~/.cache", "/.cache"),
    ])
    def test_expanduser(home, path, expanded, monkeypatch):
        monkeypatch.setenv("HOME", home)
>       assert expanduser(path) == expanded
E       AssertionError: assert 'C:\\Users\\a...______0\\home' == '/'
E         - C:\Users\appveyor\AppData\Local\Temp\1\pytest-of-appveyor\pytest-0\popen-gw1\test_expanduser_______0\home
E         + /
tests\unit\test_compat.py:147: AssertionError
__________ test_expanduser[/Users/test-~/.cache-/Users/test/.cache] ___________
[gw0] win32 -- Python 3.8.0 c:\projects\pip\.tox\py\scripts\python.exe
home = '/Users/test', path = '~/.cache', expanded = '/Users/test/.cache'
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x00000034F95631F0>
    @pytest.mark.parametrize("home,path,expanded", [
        ("/Users/test", "~", "/Users/test"),
        ("/Users/test", "~/.cache", "/Users/test/.cache"),
        # Verify that we are not affected by https://bugs.python.org/issue14768
        ("/", "~", "/"),
        ("/", "~/.cache", "/.cache"),
    ])
    def test_expanduser(home, path, expanded, monkeypatch):
        monkeypatch.setenv("HOME", home)
>       assert expanduser(path) == expanded
E       AssertionError: assert 'C:\\Users\\a...\\home/.cache' == '/Users/test/.cache'
E         - C:\Users\appveyor\AppData\Local\Temp\1\pytest-of-appveyor\pytest-0\popen-gw0\test_expanduser__Users_test___0\home/.cache
E         + /Users/test/.cache
tests\unit\test_compat.py:147: AssertionError
_____________________ test_expanduser[/-~/.cache-/.cache] _____________________
[gw0] win32 -- Python 3.8.0 c:\projects\pip\.tox\py\scripts\python.exe
home = '/', path = '~/.cache', expanded = '/.cache'
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x00000034F9689760>
    @pytest.mark.parametrize("home,path,expanded", [
        ("/Users/test", "~", "/Users/test"),
        ("/Users/test", "~/.cache", "/Users/test/.cache"),
        # Verify that we are not affected by https://bugs.python.org/issue14768
        ("/", "~", "/"),
        ("/", "~/.cache", "/.cache"),
    ])
    def test_expanduser(home, path, expanded, monkeypatch):
        monkeypatch.setenv("HOME", home)
>       assert expanduser(path) == expanded
E       AssertionError: assert 'C:\\Users\\a...\\home/.cache' == '/.cache'
E         - C:\Users\appveyor\AppData\Local\Temp\1\pytest-of-appveyor\pytest-0\popen-gw0\test_expanduser______cache___c0\home/.cache
E         + /.cache
tests\unit\test_compat.py:147: AssertionError
=========================== short test summary info ===========================
FAIL tests/unit/test_compat.py::test_expanduser[/Users/test-~-/Users/test]
FAIL tests/unit/test_compat.py::test_expanduser[/-~-/]
FAIL tests/unit/test_compat.py::test_expanduser[/Users/test-~/.cache-/Users/test/.cache]
FAIL tests/unit/test_compat.py::test_expanduser[/-~/.cache-/.cache]
ERROR tests/unit/test_build_env.py::test_build_env_allow_only_one_install
ERROR tests/unit/test_build_env.py::test_build_env_requirements_check
ERROR tests/unit/test_build_env.py::test_build_env_overlay_prefix_has_priority
ERROR tests/unit/test_build_env.py::test_build_env_isolation
ERROR tests/unit/test_wheel_builder.py::test_should_cache_git_sha
SKIP [1] tests\unit\test_collector.py:194: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_compat.py:23: condition: not hasattr(os, 'O_NOFOLLOW')
SKIP [1] tests\unit\test_compat.py:43: condition: not hasattr(os, 'O_NOFOLLOW')
SKIP [1] tests\unit\test_compat.py:31: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_configuration.py:53: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_networking_cache.py:33: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_networking_cache.py:42: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_networking_cache.py:49: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_operations_prepare.py:266: condition: sys.platform == 'win32' or sys.version_info < (3,)
SKIP [1] tests\unit\test_operations_prepare.py:285: condition: sys.platform == 'win32' or sys.version_info < (3,)
SKIP [1] tests\unit\test_locations.py:94: Incompatible with venv
SKIP [1] tests\unit\test_locations.py:112: Incompatible with venv
SKIP [1] tests\unit\test_req_install.py:17: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_req_uninstall.py:170: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_req_uninstall.py:196: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_req_uninstall.py:310: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_req_uninstall.py:342: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_urls.py:20: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_utils.py:400: condition: sys.platform == 'win32'
SKIP [5] tests\unit\test_utils_filesystem.py:32: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_utils_filesystem.py:47: condition: sys.platform == 'win32'
SKIP [2] tests\unit\test_utils_subprocess.py:105: condition: sys.version_info >= (3,)
SKIP [1] tests\unit\test_utils_temp_dir.py:13: condition: sys.platform == 'win32'
SKIP [1] tests\unit\test_vcs.py:24: Subversion is only required under Travis

@pradyunsg
Copy link
Member

ERROR: The executable C:\Users\appveyor\AppData\Local\Temp\1\pytest-of-appveyor\pytest-0\popen-gw0\virtualenv2\venv_orig\Scripts\python.exe is not functioning
ERROR: It thinks sys.prefix is 'c:\\projects\\pip' (should be 'c:\\users\\appveyor\\appdata\\local\\temp\\1\\pytest-of-appveyor\\pytest-0\\popen-gw0\\virtualenv2\\venv_orig')
ERROR: virtualenv is not compatible with this system or executable
Note: some Windows users have reported this error when they installed Python for "Only this user" or have multiple versions of Python installed. Copying the appropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem.

^ I think this is the relevant bit of output here.

@pradyunsg
Copy link
Member

@BrownTruck
Copy link
Contributor

Hello!

I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the master branch into this pull request or rebase this pull request against master then it will be eligible for code review and hopefully merging!

@BrownTruck BrownTruck added the needs rebase or merge PR has conflicts with current master label Jan 8, 2020
@chrahunt chrahunt force-pushed the azurepipelines-3.8-windows branch from b54e502 to f08dc67 Compare January 8, 2020 02:45
@pypa-bot pypa-bot removed the needs rebase or merge PR has conflicts with current master label Jan 8, 2020
@chrahunt chrahunt added the skip news Does not need a NEWS file entry (eg: trivial changes) label Jan 8, 2020
In Python 3.8, expanduser on Windows no longer respects HOME, per
https://bugs.python.org/issue36264.
@chrahunt
Copy link
Member

Looks like Python 3.8 brings a change in expanduser here. I added a commit that should maintain compatibility in that test across versions.

@hugovk hugovk marked this pull request as ready for review January 13, 2020 05:28
@pradyunsg pradyunsg merged commit b411cdb into pypa:master Jan 13, 2020
@hugovk hugovk deleted the azurepipelines-3.8-windows branch January 13, 2020 12:35
@hugovk
Copy link
Contributor Author

hugovk commented Jan 13, 2020

@chrahunt Thanks for finishing this one up!

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Feb 12, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Feb 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation skip news Does not need a NEWS file entry (eg: trivial changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants