Bug 2059941

Summary: poetry fails to build with pytest 7
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: poetryAssignee: Tomáš Hrnčiar <thrnciar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mhroncok, python-sig, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: poetry-1.1.13-1.fc37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-16 12:10:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2045102, 2050629    

Description Miro Hrončok 2022-03-02 11:36:50 UTC
In this copr repo, I have updated pytest to 7.0.1:

https://copr.fedorainfracloud.org/coprs/churchyard/pytest-7/

Based on this PR:

https://src.fedoraproject.org/rpms/pytest/pull-request/25

I'd like to update pytest to 7 in Fedora 37, but poetry 1.1.12-2 fails to build.

https://copr.fedorainfracloud.org/coprs/churchyard/pytest-7/package/poetry/


=================================== FAILURES ===================================
_________________ test_execute_executes_a_batch_of_operations __________________

config = <poetry.config.config.Config object at 0x7f2fc6680370>
pool = <poetry.repositories.pool.Pool object at 0x7f2fc6683880>
io = <clikit.io.buffered_io.BufferedIO object at 0x7f2fc6681960>
tmp_dir = '/tmp/poetry_vxe4bj6t', mock_file_downloads = None

    def test_execute_executes_a_batch_of_operations(
        config, pool, io, tmp_dir, mock_file_downloads
    ):
        config = Config()
        config.merge({"cache-dir": tmp_dir})
    
        env = MockEnv(path=Path(tmp_dir))
        executor = Executor(env, pool, config, io)
    
        file_package = Package(
            "demo",
            "0.1.0",
            source_type="file",
            source_url=Path(__file__)
            .parent.parent.joinpath(
                "fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl"
            )
            .resolve()
            .as_posix(),
        )
    
        directory_package = Package(
            "simple-project",
            "1.2.3",
            source_type="directory",
            source_url=Path(__file__)
            .parent.parent.joinpath("fixtures/simple_project")
            .resolve()
            .as_posix(),
        )
    
        git_package = Package(
            "demo",
            "0.1.0",
            source_type="git",
            source_reference="master",
            source_url="https://github.com/demo/demo.git",
        )
    
>       assert 0 == executor.execute(
            [
                Install(Package("pytest", "3.5.2")),
                Uninstall(Package("attrs", "17.4.0")),
                Update(Package("requests", "2.18.3"), Package("requests", "2.18.4")),
                Uninstall(Package("clikit", "0.2.3")).skip("Not currently installed"),
                Install(file_package),
                Install(directory_package),
                Install(git_package),
            ]
        )
E       assert 0 == 1
E        +  where 1 = <bound method Executor.execute of <poetry.installation.executor.Executor object at 0x7f2fd6644520>>([<Install pytest (3.5.2)>, <Uninstall attrs (17.4.0)>, <Update requests (2.18.3) to requests (2.18.4)>, <Uninstall cli...one-any.whl)>, <Install simple-project (1.2.3 /builddir/build/BUILD/poetry-1.1.12/tests/fixtures/simple_project)>, ...])
E        +    where <bound method Executor.execute of <poetry.installation.executor.Executor object at 0x7f2fd6644520>> = <poetry.installation.executor.Executor object at 0x7f2fd6644520>.execute

tests/installation/test_executor.py:100: AssertionError
------------------------------ Captured log call -------------------------------
DEBUG    urllib3.connectionpool:connectionpool.py:1001 Starting new HTTPS connection (1): files.pythonhosted.org:443
DEBUG    urllib3.connectionpool:connectionpool.py:456 https://files.pythonhosted.org:443 "GET /packages/ed/96/271c93f75212c06e2a7ec3e2fa8a9c90acee0a4838dc05bf379ea09aae31/pytest-3.5.0-py2.py3-none-any.whl HTTP/1.1" 200 1116
DEBUG    urllib3.connectionpool:connectionpool.py:1001 Starting new HTTPS connection (1): files.pythonhosted.org:443
DEBUG    urllib3.connectionpool:connectionpool.py:456 https://files.pythonhosted.org:443 "GET /packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl HTTP/1.1" 200 1116
__________________ test_builder_should_execute_build_scripts ___________________

extended_without_setup_poetry = <poetry.poetry.Poetry object at 0x7f2fd651da20>

    def test_builder_should_execute_build_scripts(extended_without_setup_poetry):
        env = MockEnv(path=Path("/foo"))
        builder = EditableBuilder(extended_without_setup_poetry, env, NullIO())
    
>       builder.build()

tests/masonry/builders/test_editable_builder.py:227: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
poetry/masonry/builders/editable.py:59: in build
    self._add_dist_info(added_files)
poetry/masonry/builders/editable.py:207: in _add_dist_info
    dist_info = self._env.site_packages.mkdir(dist_info_path)
poetry/utils/env.py:271: in mkdir
    return self._path_method_wrapper(path, "mkdir", *args, **kwargs)[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <poetry.utils.env.SitePackages object at 0x7f2fd64b8610>
path = PosixPath('extended_project-1.2.3.dist-info'), method = 'mkdir'
args = (), kwargs = {}, return_first = True, writable_only = False
candidates = [PosixPath('/usr/lib/python3.10/site-packages/extended_project-1.2.3.dist-info')]
results = []
candidate = PosixPath('/usr/lib/python3.10/site-packages/extended_project-1.2.3.dist-info')

    def _path_method_wrapper(
        self, path, method, *args, **kwargs
    ):  # type: (Path, str, *Any, **Any) -> Union[Tuple[Path, Any], List[Tuple[Path, Any]]]
    
        # TODO: Move to parameters after dropping Python 2.7
        return_first = kwargs.pop("return_first", True)
        writable_only = kwargs.pop("writable_only", False)
    
        candidates = self.make_candidates(path, writable_only=writable_only)
    
        if not candidates:
            raise RuntimeError(
                'Unable to find a suitable destination for "{}" in {}'.format(
                    str(path), paths_csv(self._candidates)
                )
            )
    
        results = []
    
        for candidate in candidates:
            try:
                result = candidate, getattr(candidate, method)(*args, **kwargs)
                if return_first:
                    return result
                else:
                    results.append(result)
            except (IOError, OSError):
                # TODO: Replace with PermissionError
                pass
    
        if results:
            return results
    
>       raise OSError("Unable to access any of {}".format(paths_csv(candidates)))
E       OSError: Unable to access any of "/usr/lib/python3.10/site-packages/extended_project-1.2.3.dist-info"

poetry/utils/env.py:265: OSError
=============================== warnings summary ===============================
...
=========================== short test summary info ============================
FAILED tests/installation/test_executor.py::test_execute_executes_a_batch_of_operations
FAILED tests/masonry/builders/test_editable_builder.py::test_builder_should_execute_build_scripts
= 2 failed, 655 passed, 4 skipped, 2 deselected, 18 warnings in 80.83s (0:01:20) =




There are several packages affected by this update, so I'd very much appreciate it if you could fix this failure. I've already reported this upstream in https://github.com/python-poetry/poetry/issues/4901 -- at the very least, let's exclude the 2 tests for now with a link to the upstream issue.

Thanks!

Comment 2 Fedora Update System 2022-03-16 12:09:18 UTC
FEDORA-2022-5f17953fc0 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-5f17953fc0

Comment 3 Fedora Update System 2022-03-16 12:10:33 UTC
FEDORA-2022-5f17953fc0 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.