Bug 2274125

Summary: python-hid-parser fails to build with pytest 8: TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-hid-parserAssignee: Dominik 'Rathann' Mierzejewski <dominik>
Status: CLOSED RAWHIDE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dominik, mhroncok, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-hid-parser-0.0.3-8.20210228git7d94740.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-16 15:06:07 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: 2256331    

Description Tomáš Hrnčiar 2024-04-09 09:14:12 UTC
python-hid-parser fails to build with pytest 8.

=================================== FAILURES ===================================
_________________________ test_variableitem_compliance _________________________

    def test_variableitem_compliance():
        with pytest.warns(hid_parser.HIDComplianceWarning):
            hid_parser.VariableItem(1, 2, 0, hid_parser.Usage(0x0001, 0x0001), -1, 1)
    
>       with pytest.warns(None):

tests/test_items.py:132: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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

    def __init__(
        self,
        expected_warning: 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 isinstance(expected_warning, tuple):
            for exc in expected_warning:
                if not issubclass(exc, Warning):
                    raise TypeError(msg % type(exc))
            expected_warning_tup = expected_warning
        elif isinstance(expected_warning, type) and issubclass(
            expected_warning, Warning
        ):
            expected_warning_tup = (expected_warning,)
        else:
>           raise TypeError(msg % type(expected_warning))
E           TypeError: exceptions must be derived from Warning, not <class 'NoneType'>

/usr/lib/python3.12/site-packages/_pytest/recwarn.py:285: TypeError
__________________________ test_arrayitem_compliance ___________________________

    def test_arrayitem_compliance():
        usages = [
            hid_parser.Usage(0x0001, 0x0030),
            hid_parser.Usage(0x0001, 0x0031),
        ]
    
        with pytest.warns(hid_parser.HIDComplianceWarning):
            hid_parser.ArrayItem(1, 2, 0, usages, -1, 1)
    
>       with pytest.warns(None):

tests/test_items.py:182: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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

    def __init__(
        self,
        expected_warning: 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 isinstance(expected_warning, tuple):
            for exc in expected_warning:
                if not issubclass(exc, Warning):
                    raise TypeError(msg % type(exc))
            expected_warning_tup = expected_warning
        elif isinstance(expected_warning, type) and issubclass(
            expected_warning, Warning
        ):
            expected_warning_tup = (expected_warning,)
        else:
>           raise TypeError(msg % type(expected_warning))
E           TypeError: exceptions must be derived from Warning, not <class 'NoneType'>

/usr/lib/python3.12/site-packages/_pytest/recwarn.py:285: TypeError

=========================== short test summary info ============================
FAILED tests/test_items.py::test_variableitem_compliance - TypeError: excepti...
FAILED tests/test_items.py::test_arrayitem_compliance - TypeError: exceptions...
================== 2 failed, 71 passed, 85 warnings in 0.87s ===================

https://docs.pytest.org/en/stable/changelog.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/thrnciar/pytest/fedora-rawhide-x86_64/07248187-python-hid-parser/

For all our attempts to build python-hid-parser with pytest 8, see:
https://copr.fedorainfracloud.org/coprs/thrnciar/pytest/package/python-hid-parser/

Let us know here if you have any questions.

Pytest 8 is planned to be included in Fedora 41. And this bugzilla is a
heads up before we merge new pytest into rawhide. For more info see a Fedora Change
proposal https://fedoraproject.org/wiki/Changes/Pytest_8

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 2 Dominik 'Rathann' Mierzejewski 2024-06-16 15:06:07 UTC
This is fixed in rawhide.