Bug 2057465 - python-awesomeversion fails to build with Python 3.11: AssertionError: Regex pattern "Can't compare unknown" does not match "Can't compare AwesomeVersionStrategy.UNKNOWN".
Summary: python-awesomeversion fails to build with Python 3.11: AssertionError: Regex ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-awesomeversion
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Fabian Affolter
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2022-02-23 12:50 UTC by Tomáš Hrnčiar
Modified: 2022-06-22 11:49 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-06-22 11:49:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2022-02-23 12:50:50 UTC
python-awesomeversion fails to build with Python 3.11.0a4.

=================================== FAILURES ===================================
_____________________________ test_awesomeversion ______________________________

    def test_awesomeversion():
        """Test awesomeversion."""
        version = AwesomeVersion("2020.12.1")
        assert not version.beta
    
        version = AwesomeVersion("2020.12.1a0")
        assert version.alpha
    
        version = AwesomeVersion("2020.12.1b0")
        assert version.beta
    
        version = AwesomeVersion("2020.12.1dev0")
        assert version.dev
    
        version = AwesomeVersion("2020.12.1d0")
        assert version.dev
    
        version = AwesomeVersion("2020.12.1rc0")
        assert version.release_candidate
        assert version.prefix is None
    
        version = AwesomeVersion("v2020.12.1rc0")
        assert version.prefix == "v"
    
        version2 = AwesomeVersion(version)
        assert version == version2
        assert str(version) == str(version2)
    
        assert str(version) == "v2020.12.1rc0"
        assert version.string == "2020.12.1rc0"
>       assert repr(version) == "<AwesomeVersion CalVer '2020.12.1rc0'>"
E       assert "<AwesomeVers...020.12.1rc0'>" == "<AwesomeVers...020.12.1rc0'>"
E         - <AwesomeVersion CalVer '2020.12.1rc0'>
E         + <AwesomeVersion AwesomeVersionStrategy.CALVER '2020.12.1rc0'>

tests/test_awesomeversion.py:43: AssertionError
_____________________________ test_invalid_compare _____________________________

    def test_invalid_compare():
        """Test invalid compare."""
        invalid = None
        with pytest.raises(
            AwesomeVersionCompare, match="Not a valid AwesomeVersion object"
        ):
            assert AwesomeVersion("2020.12.1") > invalid
    
        with pytest.raises(
            AwesomeVersionCompare, match="Not a valid AwesomeVersion object"
        ):
            assert AwesomeVersion("2020.12.1") < invalid
    
        with pytest.raises(
            AwesomeVersionCompare, match="Not a valid AwesomeVersion object"
        ):
            assert AwesomeVersion("2020.12.1") == invalid
    
        with pytest.raises(AwesomeVersionCompare, match="Can't compare unknown"):
>           assert AwesomeVersion("2020.12.1") > AwesomeVersion("string")

tests/test_compare.py:104: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <AwesomeVersion AwesomeVersionStrategy.CALVER '2020.12.1'>
compareto = <AwesomeVersion AwesomeVersionStrategy.UNKNOWN 'string'>

    def __gt__(self, compareto: Union[str, float, int, object]) -> bool:
        """Check if greater than."""
        if isinstance(compareto, (str, float, int)):
            compareto = AwesomeVersion(compareto)
        if not isinstance(compareto, AwesomeVersion):
            raise AwesomeVersionCompare("Not a valid AwesomeVersion object")
        if (self.strategy == AwesomeVersionStrategy.UNKNOWN) or (
            compareto.strategy == AwesomeVersionStrategy.UNKNOWN
        ):
>           raise AwesomeVersionCompare(
                f"Can't compare {AwesomeVersionStrategy.UNKNOWN}"
            )
E           awesomeversion.exceptions.AwesomeVersionCompare: Can't compare AwesomeVersionStrategy.UNKNOWN

../../BUILDROOT/python-awesomeversion-21.8.1-2.fc37.x86_64/usr/lib/python3.11/site-packages/awesomeversion/awesomeversion.py:123: AwesomeVersionCompare

During handling of the above exception, another exception occurred:

    def test_invalid_compare():
        """Test invalid compare."""
        invalid = None
        with pytest.raises(
            AwesomeVersionCompare, match="Not a valid AwesomeVersion object"
        ):
            assert AwesomeVersion("2020.12.1") > invalid
    
        with pytest.raises(
            AwesomeVersionCompare, match="Not a valid AwesomeVersion object"
        ):
            assert AwesomeVersion("2020.12.1") < invalid
    
        with pytest.raises(
            AwesomeVersionCompare, match="Not a valid AwesomeVersion object"
        ):
            assert AwesomeVersion("2020.12.1") == invalid
    
>       with pytest.raises(AwesomeVersionCompare, match="Can't compare unknown"):
E       AssertionError: Regex pattern "Can't compare unknown" does not match "Can't compare AwesomeVersionStrategy.UNKNOWN".

tests/test_compare.py:103: AssertionError
=========================== short test summary info ============================
FAILED tests/test_awesomeversion.py::test_awesomeversion - assert "<AwesomeVe...
FAILED tests/test_compare.py::test_invalid_compare - AssertionError: Regex pa...
========================= 2 failed, 96 passed in 0.25s =========================


https://docs.python.org/3.11/whatsnew/3.11.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/03525776-python-awesomeversion/

For all our attempts to build python-awesomeversion with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-awesomeversion/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
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 1 Miro Hrončok 2022-06-22 11:49:14 UTC
Closing this in bulk as it built with Python 3.11. If this needs to remain open for a followup, feel free to reopen, I won't close in bulk again.


Note You need to log in before you can comment on or make changes to this bug.