Skip to content

1.7.0: pytest is failing with setuptools > 60.0.0 because deprecation warning #196

@kloczek

Description

@kloczek

Issue

pytest is failing on create venv.

Environment

Provide at least:

  • OS: Linux x86/64
  • pip list of the host python where virtualenv is build:
Package                           Version
--------------------------------- -------------------
alabaster                         0.7.12
appdirs                           1.4.4
attrs                             21.4.0
Babel                             2.9.1
backports.entry-points-selectable 1.1.1
build                             0.7.0
chardet                           4.0.0
charset-normalizer                2.0.10
cycler                            0.11.0
dbus-python                       1.2.18
distlib                           0.3.4
distro                            1.6.0
docutils                          0.17.1
execnet                           1.9.0
extras                            1.0.0
filelock                          3.4.2
fixtures                          3.0.0
fonttools                         4.28.5
gpg                               1.16.0-unknown
idna                              3.3
imagesize                         1.3.0
importlib-metadata                4.10.0
iniconfig                         1.1.1
jaraco.packaging                  8.2.1
Jinja2                            3.0.3
kiwisolver                        1.3.2
libcomps                          0.1.18
lit                               13.0.0
lxml                              4.7.1
Mako                              1.1.6.dev0
Markdown                          3.3.6
MarkupSafe                        2.0.1
matplotlib                        3.5.1
meson                             0.60.3
mock                              4.0.3
numpy                             1.22.0
olefile                           0.46
packaging                         21.3
path                              16.2.0
pbr                               5.8.0
pep517                            0.12.0
Pillow                            9.0.0
pip                               21.3.1
platformdirs                      2.4.1
pluggy                            1.0.0
py                                1.11.0
Pygments                          2.11.1
PyGObject                         3.42.0
pyparsing                         3.0.6
pytest                            6.2.5
pytest-fixture-config             1.7.0
pytest-shutil                     1.7.0
pytest-virtualenv                 1.7.0
python-dateutil                   2.8.2
pytz                              2021.1
requests                          2.26.0
rpm                               4.17.0
rst.linker                        2.2.0
scour                             0.38.2
setuptools                        60.1.0.post20211225
setuptools-git                    1.2
setuptools-scm                    6.3.2
six                               1.16.0
smartypants                       2.0.1
snowballstemmer                   2.2.0
Sphinx                            4.3.2.dev20211231
sphinxcontrib-applehelp           1.0.2.dev20211227
sphinxcontrib-devhelp             1.0.2.dev20211228
sphinxcontrib-htmlhelp            2.0.0
sphinxcontrib-jsmath              1.0.1.dev20211227
sphinxcontrib-qthelp              1.0.3.dev20211227
sphinxcontrib-serializinghtml     1.1.5
termcolor                         1.1.0
testtools                         2.5.0
toml                              0.10.2
tomli                             2.0.0
typogrify                         2.0.7
urllib3                           1.26.7
virtualenv                        20.10.0
wcag-contrast-ratio               0.9
wheel                             0.37.1
youtube-dl                        2021.12.17
zipp                              3.7.0

Here is pytest ooutput:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-virtualenv-1.7.0-13.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-virtualenv-1.7.0-13.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-virtualenv-1.7.0, configfile: setup.cfg
plugins: virtualenv-1.7.0, shutil-1.7.0
collected 16 items

tests/integration/test_tmpvirtualenv.py F                                                                                                                            [  6%]
tests/unit/test_package_entry.py .............                                                                                                                       [ 87%]
tests/unit/test_venv.py ..                                                                                                                                           [100%]

================================================================================= FAILURES =================================================================================
_________________________________________________________________________ test_installed_packages __________________________________________________________________________

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

tests/integration/test_tmpvirtualenv.py:14:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-pytest-virtualenv-1.7.0-13.fc35.x86_64/usr/lib/python3.8/site-packages/pytest_virtualenv.py:143: in __init__
    self.run(cmd)
../../BUILDROOT/python-pytest-virtualenv-1.7.0-13.fc35.x86_64/usr/lib/python3.8/site-packages/pytest_virtualenv.py:151: in run
    return super(VirtualEnv, self).run(args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pytest_virtualenv.VirtualEnv object at 0x7f389d6f4220>, cmd = ['/usr/bin/python3', '-m', 'virtualenv', '-p', '/usr/bin/python3.8', '/tmp/tmpzu0c3ejg/.env']
capture = False, check_rc = True, cd = Path('/tmp/tmpzu0c3ejg'), shell = False
kwargs = {'env': {'AR': '/usr/bin/gcc-ar', 'BASH_FUNC_which%%': '() {  ( alias;\n eval ${which_declare} ) | /usr/bin/which --tt...es -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none', ...}}
p = <subprocess.Popen object at 0x7f389d6f4100>, out = None, _ = None
err = CalledProcessError(1, ['/usr/bin/python3', '-m', 'virtualenv', '-p', '/usr/bin/python3.8', '/tmp/tmpzu0c3ejg/.env'])

    def run(self, cmd, capture=False, check_rc=True, cd=None, shell=False, **kwargs):
        """
        Run a command relative to a given directory, defaulting to the workspace root

        Parameters
        ----------
        cmd : `str` or `list`
            Command string or list. Commands given as a string will be run in a subshell.
        capture : `bool`
            Capture and return output
        check_rc : `bool`
            Assert return code is zero
        cd : `str`
            Path to chdir to, defaults to workspace root
        """
        if isinstance(cmd, string_types):
            shell = True
        else:
            # Some of the command components might be path objects or numbers
            cmd = [str(i) for i in cmd]

        if not cd:
            cd = self.workspace

        with cmdline.chdir(cd):
            log.debug("run: {0}".format(cmd))
            if capture:
                p = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **kwargs)
            else:
                p = subprocess.Popen(cmd, shell=shell, **kwargs)
            (out, _) = p.communicate()

            if out is not None and not isinstance(out, string_types):
                out = out.decode('utf-8')

            if self.debug and capture:
                log.debug("Stdout/stderr:")
                log.debug(out)

            if check_rc and p.returncode != 0:
                err = subprocess.CalledProcessError(p.returncode, cmd)
                err.output = out
                if capture and not self.debug:
                    log.error("Stdout/stderr:")
                    log.error(out)
>               raise err
E               subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'virtualenv', '-p', '/usr/bin/python3.8', '/tmp/tmpzu0c3ejg/.env']' returned non-zero exit status 1.

/usr/lib/python3.8/site-packages/pytest_shutil/workspace.py:132: CalledProcessError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
RuntimeError: failed to build image wheel because:
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/virtualenv/seed/embed/via_app_data/via_app_data.py", line 51, in _install
    key = Path(installer_class.__name__) / wheel.path.stem
AttributeError: 'NoneType' object has no attribute 'path'

--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
/usr/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/usr/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
========================================================================= short test summary info ==========================================================================
FAILED tests/integration/test_tmpvirtualenv.py::test_installed_packages - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'virtualenv', '-p', '/usr/bi...
======================================================================= 1 failed, 15 passed in 0.83s =======================================================================

and manual test to try run that command:

[tkloczko@ss-desktop pytest-virtualenv-1.7.0]$ /usr/bin/python3 -m virtualenv -p /usr/bin/python3.8 /tmp/tmpzu0c3ejg/.env
/usr/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/usr/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
RuntimeError: failed to build image wheel because:
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/virtualenv/seed/embed/via_app_data/via_app_data.py", line 51, in _install
    key = Path(installer_class.__name__) / wheel.path.stem
AttributeError: 'NoneType' object has no attribute 'path'

[tkloczko@ss-desktop pytest-virtualenv-1.7.0]$

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions