regebro/pyroma

4.1: test_custom_test and test_minimal fails

Closed this issue · 2 comments

Both tests fails similarly:

_________________________ RatingsTest.test_custom_test _________________________

self = <pyroma.tests.RatingsTest testMethod=test_custom_test>

    def test_custom_test(self):
        rating = self._get_file_rating("custom_test")

>       self.assertEqual(
            rating,
            (   
                2,
                [   
                    "The package's version number does not comply with PEP-386 or PEP-440.",
                    "The package's description should be longer than 10 characters.",
                    "The package's long_description is quite short.",
                    "Your package does not have classifiers data.",
                    "The classifiers should specify what Python versions you support.",
                    (   
                        "You should specify what Python versions you support with "
                        "the 'requires-python'/'python_requires' metadata."
                    ),
                    "Your package does not have keywords data.",
                    "Your package does not have author data.",
                    "Your package does not have author_email data.",
                    "Your package should have a 'url' field with a link to the project home page, or a "
                    "'project_urls' field, with a dictionary of links, or both.",
                    "Your package does neither have a license field nor any license classifiers.",
                    "Specifying a development status in the classifiers gives users "
                    "a hint of how stable your software is.",
                ],
            ),
        )

pyroma/tests.py:226:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.9/vendor-packages/teamcity/diff_tools.py:33: in _patched_equals
    old(self, first, second, msg)
E   AssertionError: Tuples differ: (1, ["The package's version number does no[1209 chars]g."]) != (2, ["The package's version number does no[838 chars]s.'])
E
E   First differing element 0:
E   1
E   2
E
E   - (1,
E   + (2,
E      ["The package's version number does not comply with PEP-386 or PEP-440.",
E       "The package's description should be longer than 10 characters.",
E       "The package's long_description is quite short.",
E       'Your package does not have classifiers data.',
E       'The classifiers should specify what Python versions you support.',
E       'You should specify what Python versions you support with the '
E       "'requires-python'/'python_requires' metadata.",
E       'Your package does not have keywords data.',
E       'Your package does not have author data.',
E       'Your package does not have author_email data.',
E       "Your package should have a 'url' field with a link to the project home "
E       "page, or a 'project_urls' field, with a dictionary of links, or both.",
E       'Your package does neither have a license field nor any license classifiers.',
E       'Specifying a development status in the classifiers gives users a hint of '
E   -   'how stable your software is.',
E   ?                                 ^
E
E   +   'how stable your software is.'])
E   ?                                 ^^
E
E   -   'Your Cheese may have spoiled!! The only way to gather metadata from your '
E   -   'package was to execute a patched setup.py. This indicates that your package '
E   -   "is using very old packaging techniques, (or that your setup.py isn't "
E   -   'executable at all), and Pyroma will soon regard that as a complete '
E   -   'failure!\n'
E   -   'Please modernize your packaging! If it is already modern, this is a bug.'])
ERROR    root:projectdata.py:78 Exception raised during metadata preparation
Traceback (most recent call last):
  File "/usr/lib/python3.9/vendor-packages/build/__init__.py", line 466, in _handle_backend
    yield
  File "/usr/lib/python3.9/vendor-packages/build/__init__.py", line 459, in _call_backend
    basename: str = callback(outdir, config_settings, **kwargs)
  File "/usr/lib/python3.9/vendor-packages/pyproject_hooks/_impl.py", line 186, in prepare_metadata_for_build_wheel
    return self._call_hook('prepare_metadata_for_build_wheel', {
  File "/usr/lib/python3.9/vendor-packages/pyproject_hooks/_impl.py", line 311, in _call_hook
    self._subprocess_runner(
  File "/usr/lib/python3.9/vendor-packages/build/__init__.py", line 302, in _runner
    self._hook_runner(cmd, cwd, extra_environ)
  File "/usr/lib/python3.9/vendor-packages/pep517/wrappers.py", line 76, in quiet_subprocess_runner
    check_output(cmd, cwd=cwd, env=env, stderr=STDOUT)
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3.9', '/usr/lib/python3.9/vendor-packages/pyproject_hooks/_in_process/_in_process.py', 'prepare_metadata_for_build_wheel', '/tmp/tmph_9c9vmi']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "$(BUILD_DIR)/pyroma/projectdata.py", line 60, in get_data
    return get_build_data(path)
  File "$(BUILD_DIR)/pyroma/projectdata.py", line 29, in get_build_data
    metadata_dir = build.ProjectBuilder(str(path), runner=pep517.quiet_subprocess_runner).prepare("wheel", tempdir)
  File "/usr/lib/python3.9/vendor-packages/build/__init__.py", line 384, in prepare
    return self._call_backend(
  File "/usr/lib/python3.9/vendor-packages/build/__init__.py", line 459, in _call_backend
    basename: str = callback(outdir, config_settings, **kwargs)
  File "/usr/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/lib/python3.9/vendor-packages/build/__init__.py", line 474, in _handle_backend
    raise BuildBackendException(  # noqa: B904 # use raise from
build.BuildBackendException: Backend subprocess exited when trying to invoke prepare_metadata_for_build_wheel
___________________________ RatingsTest.test_minimal ___________________________

self = <pyroma.tests.RatingsTest testMethod=test_minimal>

    def test_minimal(self):
        rating = self._get_file_rating("minimal")

>       self.assertEqual(
            rating,
            (
                2,
                [
                    "The package's version number does not comply with PEP-386 or PEP-440.",
                    "The package's description should be longer than 10 characters.",
                    "The package's long_description is quite short.",
                    "Your package does not have classifiers data.",
                    "The classifiers should specify what Python versions you support.",
                    (
                        "You should specify what Python versions you support with "
                        "the 'requires-python'/'python_requires' metadata."
                    ),
                    "Your package does not have keywords data.",
                    "Your package does not have author data.",
                    "Your package does not have author_email data.",
                    "Your package should have a 'url' field with a link to the project home page, or a "
                    "'project_urls' field, with a dictionary of links, or both.",
                    "Your package does neither have a license field nor any license classifiers.",
                    "Specifying a development status in the classifiers gives users "
                    "a hint of how stable your software is.",
                ],
            ),
        )

pyroma/tests.py:167:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.9/vendor-packages/teamcity/diff_tools.py:33: in _patched_equals
    old(self, first, second, msg)
E   AssertionError: Tuples differ: (1, ["The package's version number does no[1209 chars]g."]) != (2, ["The package's version number does no[838 chars]s.'])
E
E   First differing element 0:
E   1
E   2
E
E   - (1,
E   + (2,
E      ["The package's version number does not comply with PEP-386 or PEP-440.",
E       "The package's description should be longer than 10 characters.",
E       "The package's long_description is quite short.",
E       'Your package does not have classifiers data.',
E       'The classifiers should specify what Python versions you support.',
E       'You should specify what Python versions you support with the '
E       "'requires-python'/'python_requires' metadata.",
E       'Your package does not have keywords data.',
E       'Your package does not have author data.',
E       'Your package does not have author_email data.',
E       "Your package should have a 'url' field with a link to the project home "
E       "page, or a 'project_urls' field, with a dictionary of links, or both.",
E       'Your package does neither have a license field nor any license classifiers.',
E       'Specifying a development status in the classifiers gives users a hint of '
E   -   'how stable your software is.',
E   ?                                 ^
E
E   +   'how stable your software is.'])
E   ?                                 ^^
E
E   -   'Your Cheese may have spoiled!! The only way to gather metadata from your '
E   -   'package was to execute a patched setup.py. This indicates that your package '
E   -   "is using very old packaging techniques, (or that your setup.py isn't "
E   -   'executable at all), and Pyroma will soon regard that as a complete '
E   -   'failure!\n'
E   -   'Please modernize your packaging! If it is already modern, this is a bug.'])
------------------------------ Captured log call -------------------------------
ERROR    root:projectdata.py:78 Exception raised during metadata preparation
Traceback (most recent call last):
  File "/usr/lib/python3.9/vendor-packages/build/__init__.py", line 466, in _handle_backend
    yield
  File "/usr/lib/python3.9/vendor-packages/build/__init__.py", line 459, in _call_backend
    basename: str = callback(outdir, config_settings, **kwargs)
  File "/usr/lib/python3.9/vendor-packages/pyproject_hooks/_impl.py", line 186, in prepare_metadata_for_build_wheel
    return self._call_hook('prepare_metadata_for_build_wheel', {
  File "/usr/lib/python3.9/vendor-packages/pyproject_hooks/_impl.py", line 311, in _call_hook
    self._subprocess_runner(
  File "/usr/lib/python3.9/vendor-packages/build/__init__.py", line 302, in _runner
    self._hook_runner(cmd, cwd, extra_environ)
  File "/usr/lib/python3.9/vendor-packages/pep517/wrappers.py", line 76, in quiet_subprocess_runner
    check_output(cmd, cwd=cwd, env=env, stderr=STDOUT)
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3.9', '/usr/lib/python3.9/vendor-packages/pyproject_hooks/_in_process/_in_process.py', 'prepare_metadata_for_build_wheel', '/tmp/tmpkx3b9dta']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "$(BUILD_DIR)/pyroma/projectdata.py", line 60, in get_data
    return get_build_data(path)
  File "$(BUILD_DIR)/pyroma/projectdata.py", line 29, in get_build_data
    metadata_dir = build.ProjectBuilder(str(path), runner=pep517.quiet_subprocess_runner).prepare("wheel", tempdir)
  File "/usr/lib/python3.9/vendor-packages/build/__init__.py", line 384, in prepare
    return self._call_backend(
  File "/usr/lib/python3.9/vendor-packages/build/__init__.py", line 459, in _call_backend
    basename: str = callback(outdir, config_settings, **kwargs)
  File "/usr/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/lib/python3.9/vendor-packages/build/__init__.py", line 474, in _handle_backend
    raise BuildBackendException(  # noqa: B904 # use raise from
build.BuildBackendException: Backend subprocess exited when trying to invoke prepare_metadata_for_build_wheel

In addition to the above failures these warnings are reported:

=============================== warnings summary ===============================
pyroma/tests.py::RatingsTest::test_custom_test
pyroma/tests.py::RatingsTest::test_minimal
  /usr/lib/python3.9/vendor-packages/setuptools/dist.py:548: UserWarning: The version specified ('0.0foo') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

OS: OpenIndiana
setuptools: 67.1.0

Thanks for the report. I've reproduced this locally, and this is due to Setuptools 66.0.0+ outright failing the build on invalid versions, rather than just issuing a deprecation warning and proceeding (with Pyroma then reporting the problem).

To fix this, I've changed the two affected test packages to use a valid version, and updated the corresponding tests accordingly, in commit regebro/pyroma@8af0f59 (#92) of PR #92 .

Ah, that answers my previous question. :-)