Bug 2059965

Summary: python-pytest-isort fails to build with pytest 7
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-pytest-isortAssignee: Fabian Affolter <mail>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mail
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-pytest-isort-3.0.0-1.fc37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-03 21:22:09 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: 2050629    

Description Miro Hrončok 2022-03-02 12:14:09 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 python-pytest-isort 2.0.0-2 fails to build.

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

=================================== FAILURES ===================================
___________________________ TestIsortItem.test_init ____________________________

self = <test_isort.TestIsortItem object at 0x7f2f6b03f820>
testdir = <Testdir local('/tmp/pytest-of-mockbuild/pytest-0/test_init0')>

    def test_init(self, testdir):
        class TestConfig:
            rootdir = testdir.tmpdir
    
            def getini(self, norecursedirs):
                return None
    
        session_mock = Mock()
        session_mock.configure_mock(
            _initialpaths=[testdir.tmpdir],
            config=TestConfig(),
        )
    
        class TestParent:
            fspath = testdir.tmpdir
            session = session_mock
            config = TestConfig()
    
        parent = TestParent()
        path = testdir.tmpdir
    
        if get_pytest_version()[0] < 5:
            test_obj = IsortItem(path, parent)
        else:
>           test_obj = IsortItem.from_parent(parent, fspath=path)

/builddir/build/BUILD/pytest-isort-2.0.0/test_isort.py:180: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/site-packages/_pytest/nodes.py:633: in from_parent
    return super().from_parent(parent=parent, fspath=fspath, path=path, **kw)
/usr/lib/python3.10/site-packages/_pytest/nodes.py:264: in from_parent
    return cls._create(parent=parent, **kw)
/usr/lib/python3.10/site-packages/_pytest/nodes.py:140: in _create
    return super().__call__(*k, **kw)
/builddir/build/BUILDROOT/python-pytest-isort-2.0.0-2.fc37.x86_64/usr/lib/python3.10/site-packages/pytest_isort.py:160: in __init__
    super(IsortItem, self).__init__(name=path, parent=parent, **kwargs)
/usr/lib/python3.10/site-packages/_pytest/nodes.py:672: in __init__
    super().__init__(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <IsortItem None>
fspath = local('/tmp/pytest-of-mockbuild/pytest-0/test_init0')
path_or_parent = <test_isort.TestIsortItem.test_init.<locals>.TestParent object at 0x7f2f6b03e5f0>
path = PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_init0')
name = 'test_init0', parent = None, config = None, session = None, nodeid = None

    def __init__(
        self,
        fspath: Optional[LEGACY_PATH] = None,
        path_or_parent: Optional[Union[Path, Node]] = None,
        path: Optional[Path] = None,
        name: Optional[str] = None,
        parent: Optional[Node] = None,
        config: Optional[Config] = None,
        session: Optional["Session"] = None,
        nodeid: Optional[str] = None,
    ) -> None:
        if path_or_parent:
            if isinstance(path_or_parent, Node):
                assert parent is None
                parent = cast(FSCollector, path_or_parent)
            elif isinstance(path_or_parent, Path):
                assert path is None
                path = path_or_parent
    
        path = _imply_path(type(self), path, fspath=fspath)
        if name is None:
            name = path.name
            if parent is not None and parent.path != path:
                try:
                    rel = path.relative_to(parent.path)
                except ValueError:
                    pass
                else:
                    name = str(rel)
                name = name.replace(os.sep, SEP)
        self.path = path
    
        if session is None:
>           assert parent is not None
E           AssertionError

/usr/lib/python3.10/site-packages/_pytest/nodes.py:602: AssertionError



There are several packages affected by this update, so I'd very much appreciate it if you could fix this failure. Please, check if your upstream hasn't already fixed it and backport the fix if possible. Report this failure to your upstream otherwise. If you need specific help, let me know.

Thanks!

Comment 1 Fedora Update System 2022-03-03 21:20:38 UTC
FEDORA-2022-f8222235b8 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-f8222235b8

Comment 2 Fedora Update System 2022-03-03 21:22:09 UTC
FEDORA-2022-f8222235b8 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.