Open kloczek opened 2 years ago
Running tox -e py310
locally on openSUSE Tumbleweed I see a subset of those errors.
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'
Fixed by the above merged pull request.
Tested and pytest still fails
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-py2pack-0.8.7-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-py2pack-0.8.7-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.14, pytest-7.1.3, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/py2pack-0.8.7
collected 48 items
test/test_py2pack.py FF......................... [ 56%]
test/test_requires.py ........... [ 79%]
test/test_template.py FFF.FF [ 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
_____________________________________________________________________ test_template[fedora.spec-False] _____________________________________________________________________
tmpdir = local('/tmp/pytest-of-tkloczko/pytest-7/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. """
if (template, fetch_tarball, sys.version_info[:2]) == ('opensuse.spec', True, (3, 6)):
raise unittest.SkipTest('This combination of tests fails ATM.')
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)
with open(filename) as filehandle:
written_spec = filehandle.read()
reference = os.path.join(compare_dir, 'py2pack-{}'.format(filename))
with open(reference) as filehandle:
required = filehandle.read()
required = required.replace('__USER__', username, 1)
required = required.replace('__YEAR__', str(datetime.date.today().year), 1)
> assert written_spec == required
E AssertionError: assert '#\n# spec fi...n%changelog\n' == '#\n# spec fi...n%changelog\n'
E Skipping 289 identical leading characters in diff, use -v to show
E - https://files.pythonhosted.org/packages/source/p/py2pack/py2pack-%{version}.tar.gz
E ? ------ ^^ -----------
E + https://pypi.io/packages/source/p/py2pack/py2pack-%{version}.tar.gz
E ? ^^^^
E BuildRoot: %{_tmppath}/%{name}-%{version}-build
E BuildRequires: python-devel...
E
E ...Full output truncated (155 lines hidden), use '-vv' to show
test/test_template.py:76: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
generating spec file for py2pack...
_____________________________________________________________________ test_template[mageia.spec-False] _____________________________________________________________________
tmpdir = local('/tmp/pytest-of-tkloczko/pytest-7/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. """
if (template, fetch_tarball, sys.version_info[:2]) == ('opensuse.spec', True, (3, 6)):
raise unittest.SkipTest('This combination of tests fails ATM.')
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)
with open(filename) as filehandle:
written_spec = filehandle.read()
reference = os.path.join(compare_dir, 'py2pack-{}'.format(filename))
with open(reference) as filehandle:
required = filehandle.read()
required = required.replace('__USER__', username, 1)
required = required.replace('__YEAR__', str(datetime.date.today().year), 1)
> assert written_spec == required
E AssertionError: assert '%define mod_..._sitelib}/*\n' == '%define mod_..._sitelib}/*\n'
E Skipping 292 identical leading characters in diff, use -v to show
E - https://files.pythonhosted.org/packages/source/p/py2pack/py2pack-%{version}.tar.gz
E ? ------ ^^ -----------
E + https://pypi.io/packages/source/p/py2pack/py2pack-%{version}.tar.gz
E ? ^^^^
E BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
E BuildRequires: python-devel...
E
E ...Full output truncated (21 lines hidden), use '-vv' to show
test/test_template.py:76: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
generating spec file for py2pack...
________________________________________________________________ test_template[opensuse-legacy.spec-False] _________________________________________________________________
tmpdir = local('/tmp/pytest-of-tkloczko/pytest-7/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. """
if (template, fetch_tarball, sys.version_info[:2]) == ('opensuse.spec', True, (3, 6)):
raise unittest.SkipTest('This combination of tests fails ATM.')
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)
with open(filename) as filehandle:
written_spec = filehandle.read()
reference = os.path.join(compare_dir, 'py2pack-{}'.format(filename))
with open(reference) as filehandle:
required = filehandle.read()
required = required.replace('__USER__', username, 1)
required = required.replace('__YEAR__', str(datetime.date.today().year), 1)
> assert written_spec == required
E AssertionError: assert '#\n# spec fi...n%changelog\n' == '#\n# spec fi...n%changelog\n'
E Skipping 947 identical leading characters in diff, use -v to show
E - https://files.pythonhosted.org/packages/source/p/py2pack/py2pack-%{version}.tar.gz
E ? ------ ^^ -----------
E + https://pypi.io/packages/source/p/py2pack/py2pack-%{version}.tar.gz
E ? ^^^^
E BuildRequires: python-setuptools
E BuildRoot: %{_tmppath}/%{name}-%{version}-build...
E
E ...Full output truncated (153 lines hidden), use '-vv' to show
test/test_template.py:76: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
generating spec file for py2pack...
____________________________________________________________________ test_template[opensuse.spec-False] ____________________________________________________________________
tmpdir = local('/tmp/pytest-of-tkloczko/pytest-7/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. """
if (template, fetch_tarball, sys.version_info[:2]) == ('opensuse.spec', True, (3, 6)):
raise unittest.SkipTest('This combination of tests fails ATM.')
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)
with open(filename) as filehandle:
written_spec = filehandle.read()
reference = os.path.join(compare_dir, 'py2pack-{}'.format(filename))
with open(reference) as filehandle:
required = filehandle.read()
required = required.replace('__USER__', username, 1)
required = required.replace('__YEAR__', str(datetime.date.today().year), 1)
> assert written_spec == required
E AssertionError: assert '#\n# spec fi...n%changelog\n' == '#\n# spec fi...n%changelog\n'
E Skipping 991 identical leading characters in diff, use -v to show
E - https://files.pythonhosted.org/packages/source/p/py2pack/py2pack-%{version}.tar.gz
E ? ------ ^^ -----------
E + https://pypi.io/packages/source/p/py2pack/py2pack-%{version}.tar.gz
E ? ^^^^
E BuildRequires: python-rpm-macros
E BuildRequires: %{python_module setuptools}...
E
E ...Full output truncated (156 lines hidden), use '-vv' to show
test/test_template.py:76: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
generating spec file for py2pack...
____________________________________________________________________ test_template[opensuse.spec-True] _____________________________________________________________________
tmpdir = local('/tmp/pytest-of-tkloczko/pytest-7/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. """
if (template, fetch_tarball, sys.version_info[:2]) == ('opensuse.spec', True, (3, 6)):
raise unittest.SkipTest('This combination of tests fails ATM.')
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)
with open(filename) as filehandle:
written_spec = filehandle.read()
reference = os.path.join(compare_dir, 'py2pack-{}'.format(filename))
with open(reference) as filehandle:
required = filehandle.read()
required = required.replace('__USER__', username, 1)
required = required.replace('__YEAR__', str(datetime.date.today().year), 1)
> assert written_spec == required
E AssertionError: assert '#\n# spec fi...n%changelog\n' == '#\n# spec fi...n%changelog\n'
E Skipping 812 identical leading characters in diff, use -v to show
E - 0.8.5
E ? ^
E + 0.8.7
E ? ^
E Release: 0
E Summary: Generate distribution packages from PyPI...
E
E ...Full output truncated (62 lines hidden), use '-vv' to show
test/test_template.py:76: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
downloading package py2pack-0.8.5...
from https://pypi.io/packages/source/p/py2pack/py2pack-0.8.5.tar.gz
generating spec file for py2pack...
========================================================================= 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_template.py::test_template[fedora.spec-False] - AssertionError: assert '#\n# spec fi...n%changelog\n' == '#\n# spec fi...n%changelog\n'
FAILED test/test_template.py::test_template[mageia.spec-False] - AssertionError: assert '%define mod_..._sitelib}/*\n' == '%define mod_..._sitelib}/*\n'
FAILED test/test_template.py::test_template[opensuse-legacy.spec-False] - AssertionError: assert '#\n# spec fi...n%changelog\n' == '#\n# spec fi...n%changelog\n'
FAILED test/test_template.py::test_template[opensuse.spec-False] - AssertionError: assert '#\n# spec fi...n%changelog\n' == '#\n# spec fi...n%changelog\n'
FAILED test/test_template.py::test_template[opensuse.spec-True] - AssertionError: assert '#\n# spec fi...n%changelog\n' == '#\n# spec fi...n%changelog\n'
====================================================================== 7 failed, 41 passed in 14.16s =======================================================================
@danigm Could you take a look, please?
It's weird, I can't reproduce this problem. It looks like the source
url is different from template, but we're using a hardcoded value here: https://github.com/openSUSE/py2pack/blob/master/py2pack/__init__.py#L223
So I don't know where these https://pypi.io/packages/source/p/py2pack/py2pack-%{version}.tar.gz
strings comes from.
@kloczek can you give more information about how you run these tests? the only place where I found the pypi.io
path is versions before 0.6.5. This commit changes the path: https://github.com/openSUSE/py2pack/commit/9e788d38b655253f3a97ea5f20d90bd378ca382d
It's weird, I can't reproduce this problem. It looks like the
source
url is different from template, but we're using a hardcoded value here: https://github.com/openSUSE/py2pack/blob/master/py2pack/__init__.py#L223So I don't know where these
https://pypi.io/packages/source/p/py2pack/py2pack-%{version}.tar.gz
strings comes from.
I'm using autogenerated from git tag tar ball (not pypi sdist one).
+++ 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
build
with--no-isolation
I'm using during all processes only locally installed modulesHere is pytest output: