Bug 2062104 - python-pynetdicom fails to build with Python 3.11: AssertionError: Regex pattern "can't set attribute" does not match "property 'as_scu' of 'PresentationContext' object has no setter".
Summary: python-pynetdicom fails to build with Python 3.11: AssertionError: Regex pat...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-pynetdicom
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ben Beasley
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2022-03-09 08:23 UTC by Tomáš Hrnčiar
Modified: 2022-03-17 14:59 UTC (History)
5 users (show)

Fixed In Version: python-pynetdicom-2.0.1-3.fc37
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-03-17 14:59:03 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2022-03-09 08:23:05 UTC
python-pynetdicom fails to build with Python 3.11.0a5.

=================================== FAILURES ===================================
_____________ TestServiceUserAcceptor.test_mode_assignment_raises ______________

self = <pynetdicom.tests.test_assoc_user.TestServiceUserAcceptor object at 0x7fbb5c75a850>

    def test_mode_assignment_raises(self):
        """Test that assigning mode after init raises exception."""
        user = ServiceUser(self.assoc, mode="acceptor")
        assert user.mode == "acceptor"
        with pytest.raises(AttributeError, match=r"can't set attribute"):
>           user.mode = "requestor"
E           AttributeError: property 'mode' of 'ServiceUser' object has no setter

pynetdicom/tests/test_assoc_user.py:168: AttributeError

During handling of the above exception, another exception occurred:

self = <pynetdicom.tests.test_assoc_user.TestServiceUserAcceptor object at 0x7fbb5c75a850>

    def test_mode_assignment_raises(self):
        """Test that assigning mode after init raises exception."""
        user = ServiceUser(self.assoc, mode="acceptor")
        assert user.mode == "acceptor"
>       with pytest.raises(AttributeError, match=r"can't set attribute"):
E       AssertionError: Regex pattern "can't set attribute" does not match "property 'mode' of 'ServiceUser' object has no setter".

pynetdicom/tests/test_assoc_user.py:167: AssertionError
___________ TestServiceUserAcceptor.test_primitive_assignment_raises ___________

self = <pynetdicom.tests.test_assoc_user.TestServiceUserAcceptor object at 0x7fbb5b12c7d0>

    def test_primitive_assignment_raises(self):
        """Test trying to set primitive parameters raises exception."""
        user = ServiceUser(self.assoc, mode="acceptor")
        user.primitive = self.primitive_ac
    
        assert user.primitive == self.primitive_ac
        assert user.mode == "acceptor"
    
        msg = r"Can't set the Maximum Length after negotiation has started"
        with pytest.raises(RuntimeError, match=msg):
            user.maximum_length = 16382
    
        msg = (
            r"Can't set the Implementation Class UID after negotiation " r"has started"
        )
        with pytest.raises(RuntimeError, match=msg):
            user.implementation_class_uid = "1.2.3"
    
        msg = (
            r"Can't set the Implementation Version Name after negotiation "
            r"has started"
        )
        with pytest.raises(RuntimeError, match=msg):
            user.implementation_version_name = "1.2.3"
    
        with pytest.raises(AttributeError, match=r"can't set attribute"):
>           user.asynchronous_operations = (1, 1)
E           AttributeError: property 'asynchronous_operations' of 'ServiceUser' object has no setter

pynetdicom/tests/test_assoc_user.py:301: AttributeError

During handling of the above exception, another exception occurred:

self = <pynetdicom.tests.test_assoc_user.TestServiceUserAcceptor object at 0x7fbb5b12c7d0>

    def test_primitive_assignment_raises(self):
        """Test trying to set primitive parameters raises exception."""
        user = ServiceUser(self.assoc, mode="acceptor")
        user.primitive = self.primitive_ac
    
        assert user.primitive == self.primitive_ac
        assert user.mode == "acceptor"
    
        msg = r"Can't set the Maximum Length after negotiation has started"
        with pytest.raises(RuntimeError, match=msg):
            user.maximum_length = 16382
    
        msg = (
            r"Can't set the Implementation Class UID after negotiation " r"has started"
        )
        with pytest.raises(RuntimeError, match=msg):
            user.implementation_class_uid = "1.2.3"
    
        msg = (
            r"Can't set the Implementation Version Name after negotiation "
            r"has started"
        )
        with pytest.raises(RuntimeError, match=msg):
            user.implementation_version_name = "1.2.3"
    
>       with pytest.raises(AttributeError, match=r"can't set attribute"):
E       AssertionError: Regex pattern "can't set attribute" does not match "property 'asynchronous_operations' of 'ServiceUser' object has no setter".

pynetdicom/tests/test_assoc_user.py:300: AssertionError
_____________ TestServiceUserRequestor.test_mode_assignment_raises _____________

self = <pynetdicom.tests.test_assoc_user.TestServiceUserRequestor object at 0x7fbb5c9d7a10>

    def test_mode_assignment_raises(self):
        """Test that assigning mode after init raises exception."""
        user = ServiceUser(self.assoc, mode="requestor")
        assert user.mode == "requestor"
        with pytest.raises(AttributeError, match=r"can't set attribute"):
>           user.mode = "acceptor"
E           AttributeError: property 'mode' of 'ServiceUser' object has no setter

pynetdicom/tests/test_assoc_user.py:1481: AttributeError

During handling of the above exception, another exception occurred:

self = <pynetdicom.tests.test_assoc_user.TestServiceUserRequestor object at 0x7fbb5c9d7a10>

    def test_mode_assignment_raises(self):
        """Test that assigning mode after init raises exception."""
        user = ServiceUser(self.assoc, mode="requestor")
        assert user.mode == "requestor"
>       with pytest.raises(AttributeError, match=r"can't set attribute"):
E       AssertionError: Regex pattern "can't set attribute" does not match "property 'mode' of 'ServiceUser' object has no setter".

pynetdicom/tests/test_assoc_user.py:1480: AssertionError
__________ TestServiceUserRequestor.test_primitive_assignment_raises ___________

self = <pynetdicom.tests.test_assoc_user.TestServiceUserRequestor object at 0x7fbb5d5f8c90>

    def test_primitive_assignment_raises(self):
        """Test trying to set primitive parameters raises exception."""
        user = ServiceUser(self.assoc, mode="requestor")
        user.primitive = self.primitive
    
        assert user.primitive == self.primitive
        assert user.mode == "requestor"
    
        msg = r"Can't set the Maximum Length after negotiation has started"
        with pytest.raises(RuntimeError, match=msg):
            user.maximum_length = 16382
    
        msg = (
            r"Can't set the Implementation Class UID after negotiation " r"has started"
        )
        with pytest.raises(RuntimeError, match=msg):
            user.implementation_class_uid = "1.2.3"
    
        msg = (
            r"Can't set the Implementation Version Name after negotiation "
            r"has started"
        )
        with pytest.raises(RuntimeError, match=msg):
            user.implementation_version_name = "1.2.3"
    
        with pytest.raises(AttributeError, match=r"can't set attribute"):
>           user.asynchronous_operations = (1, 1)
E           AttributeError: property 'asynchronous_operations' of 'ServiceUser' object has no setter

pynetdicom/tests/test_assoc_user.py:1605: AttributeError

During handling of the above exception, another exception occurred:

self = <pynetdicom.tests.test_assoc_user.TestServiceUserRequestor object at 0x7fbb5d5f8c90>

    def test_primitive_assignment_raises(self):
        """Test trying to set primitive parameters raises exception."""
        user = ServiceUser(self.assoc, mode="requestor")
        user.primitive = self.primitive
    
        assert user.primitive == self.primitive
        assert user.mode == "requestor"
    
        msg = r"Can't set the Maximum Length after negotiation has started"
        with pytest.raises(RuntimeError, match=msg):
            user.maximum_length = 16382
    
        msg = (
            r"Can't set the Implementation Class UID after negotiation " r"has started"
        )
        with pytest.raises(RuntimeError, match=msg):
            user.implementation_class_uid = "1.2.3"
    
        msg = (
            r"Can't set the Implementation Version Name after negotiation "
            r"has started"
        )
        with pytest.raises(RuntimeError, match=msg):
            user.implementation_version_name = "1.2.3"
    
>       with pytest.raises(AttributeError, match=r"can't set attribute"):
E       AssertionError: Regex pattern "can't set attribute" does not match "property 'asynchronous_operations' of 'ServiceUser' object has no setter".

pynetdicom/tests/test_assoc_user.py:1604: AssertionError
_____________________ TestPresentationContext.test_as_scp ______________________

self = <pynetdicom.tests.test_presentation.TestPresentationContext object at 0x7fbb5ba881d0>

    def test_as_scp(self):
        """Test the Presentation.as_scp property."""
        context = build_context("1.2.3")
        assert context.as_scp is None
    
        with pytest.raises(AttributeError, match=r"can't set attribute"):
>           context.as_scp = True
E           AttributeError: property 'as_scp' of 'PresentationContext' object has no setter

pynetdicom/tests/test_presentation.py:378: AttributeError

During handling of the above exception, another exception occurred:

self = <pynetdicom.tests.test_presentation.TestPresentationContext object at 0x7fbb5ba881d0>

    def test_as_scp(self):
        """Test the Presentation.as_scp property."""
        context = build_context("1.2.3")
        assert context.as_scp is None
    
>       with pytest.raises(AttributeError, match=r"can't set attribute"):
E       AssertionError: Regex pattern "can't set attribute" does not match "property 'as_scp' of 'PresentationContext' object has no setter".

pynetdicom/tests/test_presentation.py:377: AssertionError
_____________________ TestPresentationContext.test_as_scu ______________________

self = <pynetdicom.tests.test_presentation.TestPresentationContext object at 0x7fbb5c1cedd0>

    def test_as_scu(self):
        """Test the Presentation.as_scu property."""
        context = build_context("1.2.3")
        assert context.as_scu is None
    
        with pytest.raises(AttributeError, match=r"can't set attribute"):
>           context.as_scu = True
E           AttributeError: property 'as_scu' of 'PresentationContext' object has no setter

pynetdicom/tests/test_presentation.py:391: AttributeError

During handling of the above exception, another exception occurred:

self = <pynetdicom.tests.test_presentation.TestPresentationContext object at 0x7fbb5c1cedd0>

    def test_as_scu(self):
        """Test the Presentation.as_scu property."""
        context = build_context("1.2.3")
        assert context.as_scu is None
    
>       with pytest.raises(AttributeError, match=r"can't set attribute"):
E       AssertionError: Regex pattern "can't set attribute" does not match "property 'as_scu' of 'PresentationContext' object has no setter".

pynetdicom/tests/test_presentation.py:390: AssertionError
=========================== short test summary info ============================
FAILED pynetdicom/tests/test_assoc_user.py::TestServiceUserAcceptor::test_mode_assignment_raises
FAILED pynetdicom/tests/test_assoc_user.py::TestServiceUserAcceptor::test_primitive_assignment_raises
FAILED pynetdicom/tests/test_assoc_user.py::TestServiceUserRequestor::test_mode_assignment_raises
FAILED pynetdicom/tests/test_assoc_user.py::TestServiceUserRequestor::test_primitive_assignment_raises
FAILED pynetdicom/tests/test_presentation.py::TestPresentationContext::test_as_scp
FAILED pynetdicom/tests/test_presentation.py::TestPresentationContext::test_as_scu
==== 6 failed, 2858 passed, 30 skipped, 444 deselected in 827.42s (0:13:47) ====

bpo-46730: Message of AttributeError caused by getting, setting or deleting a property without the corresponding function now mentions that the attribute is in fact a property and also specifies type of the class that it belongs to.

https://bugs.python.org/issue46730
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/03648341-python-pynetdicom/

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

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 Ben Beasley 2022-03-16 13:28:07 UTC
Filed upstream: https://github.com/pydicom/pynetdicom/issues/753

Upstream PR to follow, then a downstream one.

Comment 2 Ben Beasley 2022-03-16 18:26:51 UTC
Upstream PR: https://github.com/pydicom/pynetdicom/pull/754

Downstream PR to follow.

Comment 4 Fedora Update System 2022-03-17 14:56:43 UTC
FEDORA-2022-ee1da274d1 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-ee1da274d1

Comment 5 Fedora Update System 2022-03-17 14:59:03 UTC
FEDORA-2022-ee1da274d1 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.


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