pkgconfig icon indicating copy to clipboard operation
pkgconfig copied to clipboard

1.5.5: pytest is failing

Open kloczek opened this issue 1 year ago • 2 comments

I'm packaging 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>

I'm usimg pkgconfig 1.9.3. Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pkgconfig-1.5.5-5.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pkgconfig-1.5.5-5.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pkgconfig-1.5.5
collected 35 items

test_pkgconfig.py F.......FF.F.F.F.F.F......F........                                                                                                                [100%]

================================================================================= FAILURES =================================================================================
_______________________________________________________________________________ test_exists ________________________________________________________________________________

    def test_exists():
        assert pkgconfig.exists(PACKAGE_NAME)
>       assert pkgconfig.exists('fake-openssl')
E       AssertionError: assert False
E        +  where False = <function exists at 0x7fc8cbfb0280>('fake-openssl')
E        +    where <function exists at 0x7fc8cbfb0280> = pkgconfig.exists

test_pkgconfig.py:12: AssertionError
________________________________________________________________________ test_openssl[1.1.0j-True] _________________________________________________________________________

version = '1.1.0j', expected = True

    @pytest.mark.parametrize("version,expected", [
        ('1.1.0j', True),
        ('==1.1.0j', True),
        ('==1.1.0k', False),
        ('>= 1.1.0', True),
        ('> 1.2.0', False),
        ('< 1.2.0', True),
        ('< 1.1.0', False),
        ('>= 1.1', True),
        ('> 1.2', False),
        ('< 1.2', True),
        ('< 1.1', False),
        ('>= 1.1.0c', True),
        ('>= 1.1.0k', False),
        # PLEASE NOTE:
        # the letters have no semantics, except string ordering, see also the
        # comment in the test below.
        # comparing release with beta, like "1.2.3" > "1.2.3b" does not work.
    ])
    def test_openssl(version, expected):
>       assert pkgconfig.installed('fake-openssl', version) == expected
E       AssertionError: assert False == True
E        +  where False = <function installed at 0x7fc8cbfb0670>('fake-openssl', '1.1.0j')
E        +    where <function installed at 0x7fc8cbfb0670> = pkgconfig.installed

test_pkgconfig.py:48: AssertionError
_______________________________________________________________________ test_openssl[==1.1.0j-True] ________________________________________________________________________

version = '==1.1.0j', expected = True

    @pytest.mark.parametrize("version,expected", [
        ('1.1.0j', True),
        ('==1.1.0j', True),
        ('==1.1.0k', False),
        ('>= 1.1.0', True),
        ('> 1.2.0', False),
        ('< 1.2.0', True),
        ('< 1.1.0', False),
        ('>= 1.1', True),
        ('> 1.2', False),
        ('< 1.2', True),
        ('< 1.1', False),
        ('>= 1.1.0c', True),
        ('>= 1.1.0k', False),
        # PLEASE NOTE:
        # the letters have no semantics, except string ordering, see also the
        # comment in the test below.
        # comparing release with beta, like "1.2.3" > "1.2.3b" does not work.
    ])
    def test_openssl(version, expected):
>       assert pkgconfig.installed('fake-openssl', version) == expected
E       AssertionError: assert False == True
E        +  where False = <function installed at 0x7fc8cbfb0670>('fake-openssl', '==1.1.0j')
E        +    where <function installed at 0x7fc8cbfb0670> = pkgconfig.installed

test_pkgconfig.py:48: AssertionError
_______________________________________________________________________ test_openssl[>= 1.1.0-True] ________________________________________________________________________

version = '>= 1.1.0', expected = True

    @pytest.mark.parametrize("version,expected", [
        ('1.1.0j', True),
        ('==1.1.0j', True),
        ('==1.1.0k', False),
        ('>= 1.1.0', True),
        ('> 1.2.0', False),
        ('< 1.2.0', True),
        ('< 1.1.0', False),
        ('>= 1.1', True),
        ('> 1.2', False),
        ('< 1.2', True),
        ('< 1.1', False),
        ('>= 1.1.0c', True),
        ('>= 1.1.0k', False),
        # PLEASE NOTE:
        # the letters have no semantics, except string ordering, see also the
        # comment in the test below.
        # comparing release with beta, like "1.2.3" > "1.2.3b" does not work.
    ])
    def test_openssl(version, expected):
>       assert pkgconfig.installed('fake-openssl', version) == expected
E       AssertionError: assert False == True
E        +  where False = <function installed at 0x7fc8cbfb0670>('fake-openssl', '>= 1.1.0')
E        +    where <function installed at 0x7fc8cbfb0670> = pkgconfig.installed

test_pkgconfig.py:48: AssertionError
________________________________________________________________________ test_openssl[< 1.2.0-True] ________________________________________________________________________

version = '< 1.2.0', expected = True

    @pytest.mark.parametrize("version,expected", [
        ('1.1.0j', True),
        ('==1.1.0j', True),
        ('==1.1.0k', False),
        ('>= 1.1.0', True),
        ('> 1.2.0', False),
        ('< 1.2.0', True),
        ('< 1.1.0', False),
        ('>= 1.1', True),
        ('> 1.2', False),
        ('< 1.2', True),
        ('< 1.1', False),
        ('>= 1.1.0c', True),
        ('>= 1.1.0k', False),
        # PLEASE NOTE:
        # the letters have no semantics, except string ordering, see also the
        # comment in the test below.
        # comparing release with beta, like "1.2.3" > "1.2.3b" does not work.
    ])
    def test_openssl(version, expected):
>       assert pkgconfig.installed('fake-openssl', version) == expected
E       AssertionError: assert False == True
E        +  where False = <function installed at 0x7fc8cbfb0670>('fake-openssl', '< 1.2.0')
E        +    where <function installed at 0x7fc8cbfb0670> = pkgconfig.installed

test_pkgconfig.py:48: AssertionError
________________________________________________________________________ test_openssl[>= 1.1-True] _________________________________________________________________________

version = '>= 1.1', expected = True

    @pytest.mark.parametrize("version,expected", [
        ('1.1.0j', True),
        ('==1.1.0j', True),
        ('==1.1.0k', False),
        ('>= 1.1.0', True),
        ('> 1.2.0', False),
        ('< 1.2.0', True),
        ('< 1.1.0', False),
        ('>= 1.1', True),
        ('> 1.2', False),
        ('< 1.2', True),
        ('< 1.1', False),
        ('>= 1.1.0c', True),
        ('>= 1.1.0k', False),
        # PLEASE NOTE:
        # the letters have no semantics, except string ordering, see also the
        # comment in the test below.
        # comparing release with beta, like "1.2.3" > "1.2.3b" does not work.
    ])
    def test_openssl(version, expected):
>       assert pkgconfig.installed('fake-openssl', version) == expected
E       AssertionError: assert False == True
E        +  where False = <function installed at 0x7fc8cbfb0670>('fake-openssl', '>= 1.1')
E        +    where <function installed at 0x7fc8cbfb0670> = pkgconfig.installed

test_pkgconfig.py:48: AssertionError
_________________________________________________________________________ test_openssl[< 1.2-True] _________________________________________________________________________

version = '< 1.2', expected = True

    @pytest.mark.parametrize("version,expected", [
        ('1.1.0j', True),
        ('==1.1.0j', True),
        ('==1.1.0k', False),
        ('>= 1.1.0', True),
        ('> 1.2.0', False),
        ('< 1.2.0', True),
        ('< 1.1.0', False),
        ('>= 1.1', True),
        ('> 1.2', False),
        ('< 1.2', True),
        ('< 1.1', False),
        ('>= 1.1.0c', True),
        ('>= 1.1.0k', False),
        # PLEASE NOTE:
        # the letters have no semantics, except string ordering, see also the
        # comment in the test below.
        # comparing release with beta, like "1.2.3" > "1.2.3b" does not work.
    ])
    def test_openssl(version, expected):
>       assert pkgconfig.installed('fake-openssl', version) == expected
E       AssertionError: assert False == True
E        +  where False = <function installed at 0x7fc8cbfb0670>('fake-openssl', '< 1.2')
E        +    where <function installed at 0x7fc8cbfb0670> = pkgconfig.installed

test_pkgconfig.py:48: AssertionError
_______________________________________________________________________ test_openssl[>= 1.1.0c-True] _______________________________________________________________________

version = '>= 1.1.0c', expected = True

    @pytest.mark.parametrize("version,expected", [
        ('1.1.0j', True),
        ('==1.1.0j', True),
        ('==1.1.0k', False),
        ('>= 1.1.0', True),
        ('> 1.2.0', False),
        ('< 1.2.0', True),
        ('< 1.1.0', False),
        ('>= 1.1', True),
        ('> 1.2', False),
        ('< 1.2', True),
        ('< 1.1', False),
        ('>= 1.1.0c', True),
        ('>= 1.1.0k', False),
        # PLEASE NOTE:
        # the letters have no semantics, except string ordering, see also the
        # comment in the test below.
        # comparing release with beta, like "1.2.3" > "1.2.3b" does not work.
    ])
    def test_openssl(version, expected):
>       assert pkgconfig.installed('fake-openssl', version) == expected
E       AssertionError: assert False == True
E        +  where False = <function installed at 0x7fc8cbfb0670>('fake-openssl', '>= 1.1.0c')
E        +    where <function installed at 0x7fc8cbfb0670> = pkgconfig.installed

test_pkgconfig.py:48: AssertionError
_____________________________________________________________________________ test_modversion ______________________________________________________________________________

    def test_modversion():
        assert pkgconfig.modversion(PACKAGE_NAME) == '3.2.1'
>       assert pkgconfig.modversion('fake-openssl') == '1.1.0j'

test_pkgconfig.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pkgconfig/pkgconfig.py:154: in modversion
    _raise_if_not_exists(package)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

package = 'fake-openssl'

    def _raise_if_not_exists(package):
        if not exists(package):
>           raise PackageNotFoundError(package)
E           pkgconfig.pkgconfig.PackageNotFoundError: fake-openssl not found

pkgconfig/pkgconfig.py:103: PackageNotFoundError
========================================================================= short test summary info ==========================================================================
FAILED test_pkgconfig.py::test_exists - AssertionError: assert False
FAILED test_pkgconfig.py::test_openssl[1.1.0j-True] - AssertionError: assert False == True
FAILED test_pkgconfig.py::test_openssl[==1.1.0j-True] - AssertionError: assert False == True
FAILED test_pkgconfig.py::test_openssl[>= 1.1.0-True] - AssertionError: assert False == True
FAILED test_pkgconfig.py::test_openssl[< 1.2.0-True] - AssertionError: assert False == True
FAILED test_pkgconfig.py::test_openssl[>= 1.1-True] - AssertionError: assert False == True
FAILED test_pkgconfig.py::test_openssl[< 1.2-True] - AssertionError: assert False == True
FAILED test_pkgconfig.py::test_openssl[>= 1.1.0c-True] - AssertionError: assert False == True
FAILED test_pkgconfig.py::test_modversion - pkgconfig.pkgconfig.PackageNotFoundError: fake-openssl not found
======================================================================= 9 failed, 26 passed in 0.98s =======================================================================

Here is list of installed modules in build env

Package            Version
------------------ --------------
attrs              22.1.0
Brlapi             0.8.3
build              0.8.0
charset-normalizer 2.1.0
codespell          2.1.0
cycler             0.11.0
distro             1.7.0
extras             1.0.0
fixtures           4.0.0
fonttools          4.37.1
gpg                1.17.1-unknown
idna               3.3
importlib-metadata 4.12.0
iniconfig          1.1.1
kiwisolver         1.4.4
libcomps           0.1.18
louis              3.22.0
MarkupSafe         2.1.1
matplotlib         3.5.3
natsort            8.0.2
numpy              1.23.1
olefile            0.46
packaging          21.3
pbr                5.9.0
pep517             0.12.0
Pillow             9.2.0
pip                22.2.1
pluggy             1.0.0
poetry-core        1.0.8
py                 1.11.0
PyGObject          3.42.2
pyparsing          3.0.9
pytest             7.1.2
python-dateutil    2.8.2
pytz               2022.1
rpm                4.17.0
six                1.16.0
testtools          2.5.0
tomli              2.0.1
typing_extensions  4.2.0
urllib3            1.26.12
wheel              0.37.1
zipp               3.8.1

kloczek avatar Aug 27 '22 13:08 kloczek