raimon49 / pip-licenses

Dump the license list of packages installed with pip.
MIT License
298 stars 42 forks source link

test_different_python fails #156

Closed mcepl closed 6 months ago

mcepl commented 1 year ago

While packaging for openSUSE I have find that test_different_python test fails:

[   12s] =================================== FAILURES ===================================
[   12s] ____________________________ test_different_python _____________________________
[   12s] 
[   12s]     def test_different_python() -> None:
[   12s]         import tempfile
[   12s]     
[   12s]         class TempEnvBuild(venv.EnvBuilder):
[   12s]             def post_setup(self, context: SimpleNamespace) -> None:
[   12s]                 self.context = context
[   12s]     
[   12s]         with tempfile.TemporaryDirectory() as target_dir_path:
[   12s]             venv_builder = TempEnvBuild(with_pip=True)
[   12s]             venv_builder.create(str(target_dir_path))
[   12s]             python_exec = venv_builder.context.env_exe
[   12s]             python_arg = f"--python={python_exec}"
[   12s]             args = create_parser().parse_args([python_arg, "-s", "-f=json"])
[   12s]             pkgs = get_packages(args)
[   12s]             package_names = sorted(p["name"] for p in pkgs)
[   12s]             print(package_names)
[   12s]     
[   12s] >       assert package_names == ["pip", "setuptools"]
[   12s] E       AssertionError: assert ['pip', 'pip'... 'setuptools'] == ['pip', 'setuptools']
[   12s] E         At index 1 diff: 'pip' != 'setuptools'
[   12s] E         Left contains 2 more items, first extra item: 'setuptools'
[   12s] E         Full diff:
[   12s] E         - ['pip', 'setuptools']
[   12s] E         + ['pip', 'pip', 'setuptools', 'setuptools']
[   12s] 
[   12s] test_piplicenses.py:836: AssertionError
[   12s] ----------------------------- Captured stdout call -----------------------------
[   12s] ['pip', 'pip', 'setuptools', 'setuptools']
[   12s] =============================== warnings summary ===============================
[   12s] test_piplicenses.py::TestGetLicenses::test_format_rst_default_filter
[   12s] test_piplicenses.py::TestGetLicenses::test_format_rst_without_filter
[   12s]   /home/abuild/rpmbuild/BUILD/pip-licenses-4.2.0/test_piplicenses.py:138: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
[   12s]     settings = docutils.frontend.OptionParser(
[   12s] 
[   12s] test_piplicenses.py: 136 warnings
[   12s]   /usr/lib64/python3.9/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later.
[   12s]     option = self.option_class(*args, **kwargs)
[   12s] 
[   12s] -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
[   12s] =========================== short test summary info ============================
[   12s] FAILED test_piplicenses.py::test_different_python - AssertionError: assert ['...
[   12s] =========== 1 failed, 59 passed, 1 deselected, 138 warnings in 4.89s ===========

Complete build log with all details.

raimon49 commented 1 year ago

Thanks for the report, could you please retrive the master branch HEAD and give it a try?

mcepl commented 1 year ago

Yes, master works.

stefan6419846 commented 6 months ago

This most likely could be closed then?

raimon49 commented 6 months ago

@stefan6419846 Yes, we can close this issue. Thank you!