Skip to content

Test failure with virtualenv 20.38.0+ #83

@hroncok

Description

@hroncok

When I run tests with virtualenv 20.38.0+ (e.g. with the current 21.1.0), via $ tox -e py314 -- -vv, I get the following test failure:

=================================== FAILURES ===================================
___________________ TestVirtualenvClone.test_clone_contents ____________________

self = <tests.test_virtualenv_clone.TestVirtualenvClone testMethod=test_clone_contents>

    def test_clone_contents(self):
        """Walk the virtualenv and verify clonedenv contents"""
    
        sys.argv = ['virtualenv-clone', venv_path, clone_path]
        clonevirtualenv.main()
    
        version = clonevirtualenv._virtualenv_sys(venv_path)[0]
    
        for root, dirs, files in os.walk(venv_path):
            clone_root = root.replace(venv_path,clone_path)
            for dir_ in dirs:
                dir_in_clone = os.path.join(clone_root,dir_)
                assert os.path.exists(dir_in_clone),\
                    'Directory %s is missing from cloned virtualenv' % dir_
    
            for file_ in files:
                if file_.endswith('.pyc') or\
                    file_.endswith('.exe') or\
                    file_.endswith('.egg') or\
                    file_.endswith('.zip') or\
                    file_ in ['python', 'python%s' % version]:
                    # binarys fail reading and
                    # compiled will be recompiled
                    continue
    
                file_in_clone = os.path.join(clone_root,file_)
                assert os.path.exists(file_in_clone),\
                    'File %s is missing from cloned virtualenv' % file_
    
                if os.path.islink(file_in_clone):
                    target = os.readlink(file_in_clone)
                    assert venv_path != target
                    assert venv_path not in target
                    assert os.path.basename(venv_path) not in target
                    continue
    
                with open(file_in_clone, 'rb') as f:
                    lines = f.read().decode('utf-8')
>                   assert venv_path not in lines,\
                        'Found source path in cloned file %s' % file_in_clone
E                   AssertionError: Found source path in cloned file /tmp/tmp_lsp66c7/clone_venv/pyvenv.cfg
E                   assert '/tmp/tmp_lsp66c7/srs_venv' not in 'home = /usr/bin\nimplementation = CPython\nversion_info = 3.14.3.final.0\nversion = 3.14.3\nexecutable = /usr/bin/python3.14\ncommand = /.../virtualenv-clone/.tox/py314/bin/python3 -m virtualenv /tmp/tmp_lsp66c7/srs_venv\nvirtualenv = 21.1.0\ninclude-system-site-packages = false\nbase-prefix = /usr\nbase-exec-prefix = /usr\nbase-executable = /usr/bin/python3.14\n'
E                     
E                     '/tmp/tmp_lsp66c7/srs_venv' is contained here:
E                       home = /usr/bin
E                       implementation = CPython
E                       version_info = 3.14.3.final.0
E                       version = 3.14.3
E                       executable = /usr/bin/python3.14
E                       command = /.../virtualenv-clone/.tox/py314/bin/python3 -m virtualenv /tmp/tmp_lsp66c7/srs_venv
E                     ?                                                                                                   +++++++++++++++++++++++++
E                       virtualenv = 21.1.0
E                       include-system-site-packages = false
E                       base-prefix = /usr
E                       base-exec-prefix = /usr
E                       base-executable = /usr/bin/python3.14

tests/test_virtualenv_clone.py:76: AssertionError
----------------------------- Captured stdout call -----------------------------
created virtual environment CPython3.14.3.final.0-64-x86_64 in 72ms
  creator CPython3Posix(dest=/tmp/tmp_lsp66c7/srs_venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/.../.cache/virtualenv)
    added seed packages: pip==26.0.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
=========================== short test summary info ============================
FAILED tests/test_virtualenv_clone.py::TestVirtualenvClone::test_clone_contents - AssertionError: Found source path in cloned file /tmp/tmp_lsp66c7/clone_venv/pyvenv.cfg
assert '/tmp/tmp_lsp66c7/srs_venv' not in 'home = /usr/bin\nimplementation = CPython\nversion_info = 3.14.3.final.0\nversion = 3.14.3\nexecutable = /usr/bin/python3.14\ncommand = /.../virtualenv-clone/.tox/py314/bin/python3 -m virtualenv /tmp/tmp_lsp66c7/srs_venv\nvirtualenv = 21.1.0\ninclude-system-site-packages = false\nbase-prefix = /usr\nbase-exec-prefix = /usr\nbase-executable = /usr/bin/python3.14\n'
  
  '/tmp/tmp_lsp66c7/srs_venv' is contained here:
    home = /usr/bin
    implementation = CPython
    version_info = 3.14.3.final.0
    version = 3.14.3
    executable = /usr/bin/python3.14
    command = /.../virtualenv-clone/.tox/py314/bin/python3 -m virtualenv /tmp/tmp_lsp66c7/srs_venv
  ?                                                                                                   +++++++++++++++++++++++++
    virtualenv = 21.1.0
    include-system-site-packages = false
    base-prefix = /usr
    base-exec-prefix = /usr
    base-executable = /usr/bin/python3.14
======================== 1 failed, 17 passed in 12.99s =========================
Package          Version
---------------- -------
distlib          0.4.0
filelock         3.25.0
iniconfig        2.3.0
packaging        26.0
platformdirs     4.9.4
pluggy           1.6.0
pygments         2.19.2
pytest           9.0.2
python-discovery 1.1.0
virtualenv       21.1.0
virtualenv-clone 0.5.7

This is becasue the command = /.../virtualenv-clone/.tox/py314/bin/python3 -m virtualenv /tmp/tmp_lsp66c7/srs_venv thing included in pyvenv.cfg since pypa/virtualenv@44b7bd6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions