Skip to content

0.8.7: pytest is failing #161

Description

@kloczek

+++ pytest is failing
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>

Here is pytest output:

Details
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-py2pack-0.8.7-24.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-py2pack-0.8.7-24.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/py2pack-0.8.7
collected 48 items

test/test_py2pack.py FF................F.......F                                                                                                                     [ 56%]
test/test_requires.py ...........                                                                                                                                    [ 79%]
test/test_template.py FFFFFF                                                                                                                                         [ 91%]
test/test_utils.py ....                                                                                                                                              [100%]

================================================================================= FAILURES =================================================================================
_______ Py2packTestCase.test__get_source_url_1___py2pack____py2pack_0_6_4_tar_gz____https___files_pythonhosted_org_packages_source_p_py2pack_py2pack_0_6_4_tar_gz__ ________

self = <test.test_py2pack.Py2packTestCase testMethod=test__get_source_url_1___py2pack____py2pack_0_6_4_tar_gz____https___files_pythonhosted_org_packages_source_p_py2pack_py2pack_0_6_4_tar_gz__>
pypi_name = 'py2pack', extension = 'py2pack-0.6.4.tar.gz', expected_url = 'https://files.pythonhosted.org/packages/source/p/py2pack/py2pack-0.6.4.tar.gz'

    @data(
        ('py2pack', 'py2pack-0.6.4.tar.gz',
         'https://files.pythonhosted.org/packages/source/'
         'p/py2pack/py2pack-0.6.4.tar.gz'),
        ("SQLAlchemy", 'SQLAlchemy-1.0.5.tar.gz',
         'https://files.pythonhosted.org/packages/source/'
         'S/SQLAlchemy/SQLAlchemy-1.0.5.tar.gz'),
    )
    @unpack
    def test__get_source_url(self, pypi_name, extension, expected_url):
>       self.assertEqual(py2pack._get_source_url(pypi_name, extension),
                         expected_url)
E       AssertionError: 'https://pypi.io/packages/source/p/py2pack/py2pack-0.6.4.tar.gz' != 'https://files.pythonhosted.org/packages/source/p/py2pack/py2pack-0.6.4.tar.gz'
E       - https://pypi.io/packages/source/p/py2pack/py2pack-0.6.4.tar.gz
E       ?           ^^ -
E       + https://files.pythonhosted.org/packages/source/p/py2pack/py2pack-0.6.4.tar.gz
E       ?         ++++++  ^^^^^^^^^^  ++

test/test_py2pack.py:46: AssertionError
_ Py2packTestCase.test__get_source_url_2___SQLAlchemy____SQLAlchemy_1_0_5_tar_gz____https___files_pythonhosted_org_packages_source_S_SQLAlchemy_SQLAlchemy_1_0_5_tar_gz__ __

self = <test.test_py2pack.Py2packTestCase testMethod=test__get_source_url_2___SQLAlchemy____SQLAlchemy_1_0_5_tar_gz____https___files_pythonhosted_org_packages_source_S_SQLAlchemy_SQLAlchemy_1_0_5_tar_gz__>
pypi_name = 'SQLAlchemy', extension = 'SQLAlchemy-1.0.5.tar.gz', expected_url = 'https://files.pythonhosted.org/packages/source/S/SQLAlchemy/SQLAlchemy-1.0.5.tar.gz'

    @data(
        ('py2pack', 'py2pack-0.6.4.tar.gz',
         'https://files.pythonhosted.org/packages/source/'
         'p/py2pack/py2pack-0.6.4.tar.gz'),
        ("SQLAlchemy", 'SQLAlchemy-1.0.5.tar.gz',
         'https://files.pythonhosted.org/packages/source/'
         'S/SQLAlchemy/SQLAlchemy-1.0.5.tar.gz'),
    )
    @unpack
    def test__get_source_url(self, pypi_name, extension, expected_url):
>       self.assertEqual(py2pack._get_source_url(pypi_name, extension),
                         expected_url)
E       AssertionError: 'https://pypi.io/packages/source/S/SQLAlchemy/SQLA[15 chars]r.gz' != 'https://files.pythonhosted.org/packages/source/S/[30 chars]r.gz'
E       - https://pypi.io/packages/source/S/SQLAlchemy/SQLAlchemy-1.0.5.tar.gz
E       ?           ^^ -
E       + https://files.pythonhosted.org/packages/source/S/SQLAlchemy/SQLAlchemy-1.0.5.tar.gz
E       ?         ++++++  ^^^^^^^^^^  ++

test/test_py2pack.py:46: AssertionError
_________________________________________________________________ Py2packTestCase.test_newest_download_url _________________________________________________________________

self = <test.test_py2pack.Py2packTestCase testMethod=test_newest_download_url>

    def test_newest_download_url(self):
>       py2pack.fetch_data(self.args)

test/test_py2pack.py:59:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = <test.test_py2pack.Py2packTestCase.setUp.<locals>.Args object at 0x7fa862cae130>

    def fetch_data(args):
        args.fetched_data = pypi_json(args.name, args.version)
>       releases = args.fetched_data['releases']
E       KeyError: 'releases'

py2pack/__init__.py:284: KeyError
________________________________________________________________________ Py2packTestCase.test_show _________________________________________________________________________

self = <test.test_py2pack.Py2packTestCase testMethod=test_show>

    def test_show(self):
>       py2pack.show(self.args)

test/test_py2pack.py:56:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
py2pack/__init__.py:88: in show
    fetch_data(args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = <test.test_py2pack.Py2packTestCase.setUp.<locals>.Args object at 0x7fa862c65d60>

    def fetch_data(args):
        args.fetched_data = pypi_json(args.name, args.version)
>       releases = args.fetched_data['releases']
E       KeyError: 'releases'

py2pack/__init__.py:284: KeyError
_____________________________________________________________________ test_template[fedora.spec-False] _____________________________________________________________________

tmpdir = local('/tmp/pytest-of-tkloczko/pytest-871/test_template_fedora_spec_Fals0'), template = 'fedora.spec', fetch_tarball = False

    @pytest.mark.parametrize('template, fetch_tarball',
                             [('fedora.spec', False),
                              ('mageia.spec', False),
                              ('opensuse-legacy.spec', False),
                              ('opensuse.dsc', False),
                              ('opensuse.spec', False),
                              ('opensuse.spec', True)])
    def test_template(tmpdir, template, fetch_tarball):
        """ Test if generated specfile equals to stored one. """
        args = Args()
        args.template = template
        base, ext = template.split(".")
        suffix = '-augmented' if fetch_tarball else ''
        filename = "{}{}.{}".format(base, suffix, ext)
        args.filename = filename
        with tmpdir.as_cwd():
            if fetch_tarball:
                py2pack.fetch(args)
                py2pack.generate(args)
            else:
                with pytest.warns(UserWarning, match="No tarball"):
>                   py2pack.generate(args)

test/test_template.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
py2pack/__init__.py:233: in generate
    fetch_data(args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = <test.test_template.Args object at 0x7fa8628ffd60>

    def fetch_data(args):
        args.fetched_data = pypi_json(args.name, args.version)
>       releases = args.fetched_data['releases']
E       KeyError: 'releases'

py2pack/__init__.py:284: KeyError
_____________________________________________________________________ test_template[mageia.spec-False] _____________________________________________________________________

tmpdir = local('/tmp/pytest-of-tkloczko/pytest-871/test_template_mageia_spec_Fals0'), template = 'mageia.spec', fetch_tarball = False

    @pytest.mark.parametrize('template, fetch_tarball',
                             [('fedora.spec', False),
                              ('mageia.spec', False),
                              ('opensuse-legacy.spec', False),
                              ('opensuse.dsc', False),
                              ('opensuse.spec', False),
                              ('opensuse.spec', True)])
    def test_template(tmpdir, template, fetch_tarball):
        """ Test if generated specfile equals to stored one. """
        args = Args()
        args.template = template
        base, ext = template.split(".")
        suffix = '-augmented' if fetch_tarball else ''
        filename = "{}{}.{}".format(base, suffix, ext)
        args.filename = filename
        with tmpdir.as_cwd():
            if fetch_tarball:
                py2pack.fetch(args)
                py2pack.generate(args)
            else:
                with pytest.warns(UserWarning, match="No tarball"):
>                   py2pack.generate(args)

test/test_template.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
py2pack/__init__.py:233: in generate
    fetch_data(args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = <test.test_template.Args object at 0x7fa86290b6a0>

    def fetch_data(args):
        args.fetched_data = pypi_json(args.name, args.version)
>       releases = args.fetched_data['releases']
E       KeyError: 'releases'

py2pack/__init__.py:284: KeyError
________________________________________________________________ test_template[opensuse-legacy.spec-False] _________________________________________________________________

tmpdir = local('/tmp/pytest-of-tkloczko/pytest-871/test_template_opensuse_legacy_0'), template = 'opensuse-legacy.spec', fetch_tarball = False

    @pytest.mark.parametrize('template, fetch_tarball',
                             [('fedora.spec', False),
                              ('mageia.spec', False),
                              ('opensuse-legacy.spec', False),
                              ('opensuse.dsc', False),
                              ('opensuse.spec', False),
                              ('opensuse.spec', True)])
    def test_template(tmpdir, template, fetch_tarball):
        """ Test if generated specfile equals to stored one. """
        args = Args()
        args.template = template
        base, ext = template.split(".")
        suffix = '-augmented' if fetch_tarball else ''
        filename = "{}{}.{}".format(base, suffix, ext)
        args.filename = filename
        with tmpdir.as_cwd():
            if fetch_tarball:
                py2pack.fetch(args)
                py2pack.generate(args)
            else:
                with pytest.warns(UserWarning, match="No tarball"):
>                   py2pack.generate(args)

test/test_template.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
py2pack/__init__.py:233: in generate
    fetch_data(args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = <test.test_template.Args object at 0x7fa8628ff190>

    def fetch_data(args):
        args.fetched_data = pypi_json(args.name, args.version)
>       releases = args.fetched_data['releases']
E       KeyError: 'releases'

py2pack/__init__.py:284: KeyError
____________________________________________________________________ test_template[opensuse.dsc-False] _____________________________________________________________________

tmpdir = local('/tmp/pytest-of-tkloczko/pytest-871/test_template_opensuse_dsc_Fal0'), template = 'opensuse.dsc', fetch_tarball = False

    @pytest.mark.parametrize('template, fetch_tarball',
                             [('fedora.spec', False),
                              ('mageia.spec', False),
                              ('opensuse-legacy.spec', False),
                              ('opensuse.dsc', False),
                              ('opensuse.spec', False),
                              ('opensuse.spec', True)])
    def test_template(tmpdir, template, fetch_tarball):
        """ Test if generated specfile equals to stored one. """
        args = Args()
        args.template = template
        base, ext = template.split(".")
        suffix = '-augmented' if fetch_tarball else ''
        filename = "{}{}.{}".format(base, suffix, ext)
        args.filename = filename
        with tmpdir.as_cwd():
            if fetch_tarball:
                py2pack.fetch(args)
                py2pack.generate(args)
            else:
                with pytest.warns(UserWarning, match="No tarball"):
>                   py2pack.generate(args)

test/test_template.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
py2pack/__init__.py:233: in generate
    fetch_data(args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = <test.test_template.Args object at 0x7fa862840460>

    def fetch_data(args):
        args.fetched_data = pypi_json(args.name, args.version)
>       releases = args.fetched_data['releases']
E       KeyError: 'releases'

py2pack/__init__.py:284: KeyError
____________________________________________________________________ test_template[opensuse.spec-False] ____________________________________________________________________

tmpdir = local('/tmp/pytest-of-tkloczko/pytest-871/test_template_opensuse_spec_Fa0'), template = 'opensuse.spec', fetch_tarball = False

    @pytest.mark.parametrize('template, fetch_tarball',
                             [('fedora.spec', False),
                              ('mageia.spec', False),
                              ('opensuse-legacy.spec', False),
                              ('opensuse.dsc', False),
                              ('opensuse.spec', False),
                              ('opensuse.spec', True)])
    def test_template(tmpdir, template, fetch_tarball):
        """ Test if generated specfile equals to stored one. """
        args = Args()
        args.template = template
        base, ext = template.split(".")
        suffix = '-augmented' if fetch_tarball else ''
        filename = "{}{}.{}".format(base, suffix, ext)
        args.filename = filename
        with tmpdir.as_cwd():
            if fetch_tarball:
                py2pack.fetch(args)
                py2pack.generate(args)
            else:
                with pytest.warns(UserWarning, match="No tarball"):
>                   py2pack.generate(args)

test/test_template.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
py2pack/__init__.py:233: in generate
    fetch_data(args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = <test.test_template.Args object at 0x7fa8628c03d0>

    def fetch_data(args):
        args.fetched_data = pypi_json(args.name, args.version)
>       releases = args.fetched_data['releases']
E       KeyError: 'releases'

py2pack/__init__.py:284: KeyError
____________________________________________________________________ test_template[opensuse.spec-True] _____________________________________________________________________

tmpdir = local('/tmp/pytest-of-tkloczko/pytest-871/test_template_opensuse_spec_Tr0'), template = 'opensuse.spec', fetch_tarball = True

    @pytest.mark.parametrize('template, fetch_tarball',
                             [('fedora.spec', False),
                              ('mageia.spec', False),
                              ('opensuse-legacy.spec', False),
                              ('opensuse.dsc', False),
                              ('opensuse.spec', False),
                              ('opensuse.spec', True)])
    def test_template(tmpdir, template, fetch_tarball):
        """ Test if generated specfile equals to stored one. """
        args = Args()
        args.template = template
        base, ext = template.split(".")
        suffix = '-augmented' if fetch_tarball else ''
        filename = "{}{}.{}".format(base, suffix, ext)
        args.filename = filename
        with tmpdir.as_cwd():
            if fetch_tarball:
>               py2pack.fetch(args)

test/test_template.py:60:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
py2pack/__init__.py:94: in fetch
    fetch_data(args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = <test.test_template.Args object at 0x7fa86290bf10>

    def fetch_data(args):
        args.fetched_data = pypi_json(args.name, args.version)
>       releases = args.fetched_data['releases']
E       KeyError: 'releases'

py2pack/__init__.py:284: KeyError
========================================================================= short test summary info ==========================================================================
FAILED test/test_py2pack.py::Py2packTestCase::test__get_source_url_1___py2pack____py2pack_0_6_4_tar_gz____https___files_pythonhosted_org_packages_source_p_py2pack_py2pack_0_6_4_tar_gz__
FAILED test/test_py2pack.py::Py2packTestCase::test__get_source_url_2___SQLAlchemy____SQLAlchemy_1_0_5_tar_gz____https___files_pythonhosted_org_packages_source_S_SQLAlchemy_SQLAlchemy_1_0_5_tar_gz__
FAILED test/test_py2pack.py::Py2packTestCase::test_newest_download_url - KeyError: 'releases'
FAILED test/test_py2pack.py::Py2packTestCase::test_show - KeyError: 'releases'
FAILED test/test_template.py::test_template[fedora.spec-False] - KeyError: 'releases'
FAILED test/test_template.py::test_template[mageia.spec-False] - KeyError: 'releases'
FAILED test/test_template.py::test_template[opensuse-legacy.spec-False] - KeyError: 'releases'
FAILED test/test_template.py::test_template[opensuse.dsc-False] - KeyError: 'releases'
FAILED test/test_template.py::test_template[opensuse.spec-False] - KeyError: 'releases'
FAILED test/test_template.py::test_template[opensuse.spec-True] - KeyError: 'releases'
====================================================================== 10 failed, 38 passed in 11.20s ======================================================================

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions