Bug 2059950

Summary: python-dateutil fails to build with pytest 7
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-dateutilAssignee: Haïkel Guémar <karlthered>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: code, gwync, igor.raits, jspaleta, karlthered, pj.pandit, python-sig, tomspur
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-dateutil-2.8.2-1.fc37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-11 07:22:56 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:50:44 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-dateutil 1:2.8.1-8 fails to build.


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

=================================== FAILURES ===================================
_____________________ test_parser_parser_private_not_warns _____________________

    @pytest.mark.skipif(IS_PY32, reason='pytest.warns not supported on Python 3.2')
    def test_parser_parser_private_not_warns():
        from dateutil.parser._parser import _timelex, _tzparser
        from dateutil.parser._parser import _parsetz
    
>       with pytest.warns(None) as recorder:

dateutil/test/test_internals.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = WarningsChecker(record=True), expected_warning = None, match_expr = None

    def __init__(
        self,
        expected_warning: Optional[
            Union[Type[Warning], Tuple[Type[Warning], ...]]
        ] = Warning,
        match_expr: Optional[Union[str, Pattern[str]]] = None,
        *,
        _ispytest: bool = False,
    ) -> None:
        check_ispytest(_ispytest)
        super().__init__(_ispytest=True)
    
        msg = "exceptions must be derived from Warning, not %s"
        if expected_warning is None:
>           warnings.warn(WARNS_NONE_ARG, stacklevel=4)
E           pytest.PytestRemovedIn8Warning: Passing None has been deprecated.
E           See https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.

/usr/lib/python3.10/site-packages/_pytest/recwarn.py:246: PytestRemovedIn8Warning
=========================== short test summary info ============================
FAILED dateutil/test/test_internals.py::test_parser_parser_private_not_warns
============ 1 failed, 2009 passed, 47 skipped, 19 xfailed in 6.57s ============



This calls pytest.warns(None) which is not allowed see https://github.com/pytest-dev/pytest/issues/9002



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 Ben Beasley 2022-03-10 17:56:24 UTC
These tests were re-written for the current version of dateutil, 3.8.2[1]. I suspect that a simple upgrade to that version will resolve this issue, too. 

[1] https://github.com/dateutil/dateutil/commit/353c4af84add0a9ac47adc792867935fe631875f

Comment 2 Ben Beasley 2022-03-10 18:17:45 UTC
Sorry, this is actually not fixed in 3.8.2. It is fixed in an unreleased commit, https://github.com/dateutil/dateutil/commit/2bdd63158b7f981fc6d70a869680451bdfd8d848.

Comment 3 Ben Beasley 2022-03-10 18:34:31 UTC
The following PR should fix this and bug 1982169:

https://src.fedoraproject.org/rpms/python-dateutil/pull-request/10

Comment 4 Fedora Update System 2022-03-11 07:21:29 UTC
FEDORA-2022-2d8cecbf55 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-2d8cecbf55

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