Skip to content

2.1.18: pytest is failing in four units #55

@kloczek

Description

@kloczek

I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-virtualenv-api-2.1.18-6.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-virtualenv-api-2.1.18-6.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra tests.py
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/virtualenv-api-2.1.18
collected 10 items

tests.py .....FFFF.                                                                                                                                                  [100%]

================================================================================= FAILURES =================================================================================
________________________________________________________________________ SearchTestCase.test_search ________________________________________________________________________

self = <tests.SearchTestCase testMethod=test_search>

    def test_search(self):
        for pack in all_packages_for_tests:
>           result = self.virtual_env_obj.search(pack)

tests.py:106:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
virtualenvapi/manage.py:307: in search
    results = self._execute_pip(['search', term], log=False)  # Don't want to log searches
virtualenvapi/manage.py:132: in _execute_pip
    return self._execute(exec_args, log=log)
virtualenvapi/manage.py:156: in _execute
    raise e
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <virtualenvapi.manage.VirtualEnvironment object at 0x7f54fe45cf10>, args = ['bin/python', '-m', 'pip', '--disable-pip-version-check', 'search', 'pep8'], log = False

    def _execute(self, args, log=True):
        """Executes the given command inside the environment and returns the output."""
        if not self._ready:
            self.open_or_create()
        output = ''
        error = ''
        try:
            proc = subprocess.Popen(args, cwd=self.path, env=self.env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            output, error = proc.communicate()
            returncode = proc.returncode
            if returncode:
>               raise subprocess.CalledProcessError(returncode, proc, (output, error))
E               subprocess.CalledProcessError: Command '<subprocess.Popen object at 0x7f54fe45cb50>' returned non-zero exit status 1.

virtualenvapi/manage.py:145: CalledProcessError
_____________________________________________________________________ SearchTestCase.test_search_names _____________________________________________________________________

self = <tests.SearchTestCase testMethod=test_search_names>

    def test_search_names(self):
        for pack in all_packages_for_tests:
>           result = self.virtual_env_obj.search_names(pack)

tests.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
virtualenvapi/manage.py:323: in search_names
    return list(self.search(term).keys())
virtualenvapi/manage.py:307: in search
    results = self._execute_pip(['search', term], log=False)  # Don't want to log searches
virtualenvapi/manage.py:132: in _execute_pip
    return self._execute(exec_args, log=log)
virtualenvapi/manage.py:156: in _execute
    raise e
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <virtualenvapi.manage.VirtualEnvironment object at 0x7f54fe477790>, args = ['bin/python', '-m', 'pip', '--disable-pip-version-check', 'search', 'pep8'], log = False

    def _execute(self, args, log=True):
        """Executes the given command inside the environment and returns the output."""
        if not self._ready:
            self.open_or_create()
        output = ''
        error = ''
        try:
            proc = subprocess.Popen(args, cwd=self.path, env=self.env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            output, error = proc.communicate()
            returncode = proc.returncode
            if returncode:
>               raise subprocess.CalledProcessError(returncode, proc, (output, error))
E               subprocess.CalledProcessError: Command '<subprocess.Popen object at 0x7f54fe477820>' returned non-zero exit status 1.

virtualenvapi/manage.py:145: CalledProcessError
________________________________________________________________ PythonArgumentTestCase.test_python_version ________________________________________________________________

self = <tests.PythonArgumentTestCase testMethod=test_python_version>

    def setUp(self):
        self.env_path = tempfile.mkdtemp()
        self.python = which('python')
>       self.assertIsNotNone(self.python)
E       AssertionError: unexpectedly None

tests.py:127: AssertionError
___________________________________________________________ SystemSitePackagesTest.test_no_system_site_packages ____________________________________________________________

self = <tests.SystemSitePackagesTest testMethod=test_no_system_site_packages>

    def test_no_system_site_packages(self):
        """
        test that creating a venv with system_site_packages=False
        results in a venv that contains the no-global-site-packages
        file

        """
        venv = VirtualEnvironment(self.dir)
        venv._create()
        expected = os.path.join(venv.path, self.no_global)
>       self.assertTrue(
            os.path.exists(expected)
        )
E       AssertionError: False is not true

tests.py:187: AssertionError
========================================================================= short test summary info ==========================================================================
FAILED tests.py::SearchTestCase::test_search - subprocess.CalledProcessError: Command '<subprocess.Popen object at 0x7f54fe45cb50>' returned non-zero exit status 1.
FAILED tests.py::SearchTestCase::test_search_names - subprocess.CalledProcessError: Command '<subprocess.Popen object at 0x7f54fe477820>' returned non-zero exit status 1.
FAILED tests.py::PythonArgumentTestCase::test_python_version - AssertionError: unexpectedly None
FAILED tests.py::SystemSitePackagesTest::test_no_system_site_packages - AssertionError: False is not true
======================================================================= 4 failed, 6 passed in 57.93s =======================================================================

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