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

pytest-virtualenv fails tests on Python 3.12 #220

Open
mgorny opened this issue May 27, 2023 · 0 comments
Open

pytest-virtualenv fails tests on Python 3.12 #220

mgorny opened this issue May 27, 2023 · 0 comments

Comments

@mgorny
Copy link
Contributor

mgorny commented May 27, 2023

(after fixing pytest-shutil via #219)

============================================================== FAILURES ===============================================================
_______________________________________________________ test_installed_packages _______________________________________________________

    def test_installed_packages():
        with venv.VirtualEnv() as v:
>           ips = v.installed_packages()

v          = <pytest_virtualenv.VirtualEnv object at 0x7f1db7343c80>

tests/integration/test_tmpvirtualenv.py:15: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pytest_virtualenv.py:227: in installed_packages
    lines = self.run([self.python, "-c", code], capture=True).split('\n')
        code       = ('from pkg_resources import working_set\n'
 "for i in working_set: print(i.project_name + ' ' + i.version + ' ' + "
 'i.location)')
        package_type = 'ANY'
        res        = {}
        self       = <pytest_virtualenv.VirtualEnv object at 0x7f1db7343c80>
pytest_virtualenv.py:151: in run
    return super(VirtualEnv, self).run(args, **kwargs)
        __class__  = <class 'pytest_virtualenv.VirtualEnv'>
        args       = [Path('/tmp/portage/dev-python/pytest-virtualenv-1.7.0-r2/temp/tmpcd8n598l/.env/bin/python'),
 '-c',
 'from pkg_resources import working_set\n'
 "for i in working_set: print(i.project_name + ' ' + i.version + ' ' + "
 'i.location)']
        kwargs     = {'capture': True,
 'env': {[...]}}
out        = ('Traceback (most recent call last):\n'
 '  File "<string>", line 1, in <module>\n'
 "ModuleNotFoundError: No module named 'pkg_resources'\n")
p          = <Popen: returncode: 1 args: ['/tmp/portage/dev-python/pytest-virtualenv-1.7....>
self       = <pytest_virtualenv.VirtualEnv object at 0x7f1db7343c80>
shell      = False

/usr/lib/python3.12/site-packages/pytest_shutil/workspace.py:132: CalledProcessError
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------
created virtual environment CPython3.12.0.beta.1-64 in 445ms
  creator CPython3Posix(dest=/tmp/portage/dev-python/pytest-virtualenv-1.7.0-r2/temp/tmpcd8n598l/.env, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/tmp/portage/dev-python/pytest-virtualenv-1.7.0-r2/homedir/.local/share/virtualenv)
    added seed packages: pip==23.1.2
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
---------------------------------------------------------- Captured log call ----------------------------------------------------------
ERROR    pytest_shutil.workspace:workspace.py:130 Stdout/stderr:
ERROR    pytest_shutil.workspace:workspace.py:131 Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pkg_resources'

Apparently it assumes that pkg_resources package will be available in the freshly created virtualenv which is no longer the case with Python 3.12 (setuptools is no longer included in new virtualenv, just pip).

JamesWrigley added a commit to European-XFEL/DAMNIT that referenced this issue Jul 5, 2024
Because pytest-virtualenv does not support Python 3.12:
man-group/pytest-plugins#220

It's a relatively small amount of code so if this causes problems in the future
maybe we should just vendor it in.
hongchaodeng added a commit to hongchaodeng/ray that referenced this issue Jul 11, 2024
pytest-virtualenv doesn't support python 3.12 yet:

man-group/pytest-plugins#220
Signed-off-by: hongchaodeng <[email protected]>
hongchaodeng added a commit to hongchaodeng/ray that referenced this issue Jul 11, 2024
pytest-virtualenv doesn't support python 3.12 yet:

man-group/pytest-plugins#220
Signed-off-by: hongchaodeng <[email protected]>
can-anyscale pushed a commit to ray-project/ray that referenced this issue Jul 11, 2024
pytest-virtualenv doesn't support python 3.12 yet:

man-group/pytest-plugins#220

Signed-off-by: hongchaodeng <[email protected]>
hongchaodeng added a commit to hongchaodeng/ray that referenced this issue Jul 11, 2024
pytest-virtualenv doesn't support python 3.12 yet:

man-group/pytest-plugins#220
Signed-off-by: hongchaodeng <[email protected]>
can-anyscale pushed a commit to ray-project/ray that referenced this issue Jul 11, 2024
pytest-virtualenv doesn't support python 3.12 yet:

man-group/pytest-plugins#220

Signed-off-by: hongchaodeng <[email protected]>
hongchaodeng added a commit to hongchaodeng/ray that referenced this issue Jul 12, 2024
pytest-virtualenv doesn't support python 3.12 yet:

man-group/pytest-plugins#220

Signed-off-by: hongchaodeng <[email protected]>
hongchaodeng added a commit to hongchaodeng/ray that referenced this issue Jul 12, 2024
pytest-virtualenv doesn't support python 3.12 yet:

man-group/pytest-plugins#220

Signed-off-by: hongchaodeng <[email protected]>
Catch-Bull pushed a commit to Catch-Bull/ray that referenced this issue Jul 15, 2024
pytest-virtualenv doesn't support python 3.12 yet:

man-group/pytest-plugins#220

Signed-off-by: hongchaodeng <[email protected]>
Signed-off-by: hejialing.hjl <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant