Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added Python 3.12 in the CI #1812

Merged
merged 4 commits into from
Oct 18, 2023
Merged

added Python 3.12 in the CI #1812

merged 4 commits into from
Oct 18, 2023

Conversation

auvipy
Copy link
Member

@auvipy auvipy commented Oct 12, 2023

No description provided.

@auvipy auvipy added this to the 5.3.x milestone Oct 12, 2023
@auvipy
Copy link
Member Author

auvipy commented Oct 12, 2023

=================================== FAILURES ===================================
______________________ test_Hub.test_call_soon_uses_lock _______________________

self = <t.unit.asynchronous.test_hub.test_Hub object at 0x7fc18972a150>

def test_call_soon_uses_lock(self):
    callback = Mock(name='callback')
    with patch.object(self.hub, '_ready_lock', autospec=True) as lock:
        self.hub.call_soon(callback)
      assert lock.__enter__.called_once()

t/unit/asynchronous/test_hub.py:196:


self =
name = 'called_once'

def __getattr__(self, name):
    if name in {'_mock_methods', '_mock_unsafe'}:
        raise AttributeError(name)
    elif self._mock_methods is not None:
        if name not in self._mock_methods or name in _all_magics:
            raise AttributeError("Mock object has no attribute %r" % name)
    elif _is_magic(name):
        raise AttributeError(name)
    if not self._mock_unsafe and (not self._mock_methods or name not in self._mock_methods):
        if name.startswith(('assert', 'assret', 'asert', 'aseert', 'assrt')) or name in _ATTRIB_DENY_LIST:
          raise AttributeError(
                f"{name!r} is not a valid assertion. Use a spec "
                f"for the mock if {name!r} is meant to be an attribute.")

E AttributeError: 'called_once' is not a valid assertion. Use a spec for the mock if 'called_once' is meant to be an attribute.

@ThiefMaster
Copy link

ThiefMaster commented Oct 12, 2023

assert somemock.called_once does not exist and was always broken (you were asserting a newly created mock object, and not the result of whether the original one has been called), you need to call somemock.assert_called_once() instead

-assert lock.__enter__.called_once()
+lock.__enter__.assert_called_once()

should fix it

@auvipy
Copy link
Member Author

auvipy commented Oct 13, 2023

thanks Adrian

@@ -131,4 +133,4 @@ commands =
pydocstyle {toxinidir}/kombu

[testenv:mypy]
commands = python -m mypy --config-file setup.cfg
commands = python -m mypy --config-file setup.cfg

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may want to configure your editor to automatically end a file with a linebreak ;)

@auvipy
Copy link
Member Author

auvipy commented Oct 18, 2023

I think the failure should be fixed by 3ad075a

@auvipy auvipy marked this pull request as ready for review October 18, 2023 09:50
@auvipy auvipy merged commit 6c8e7e6 into main Oct 18, 2023
15 of 17 checks passed
@auvipy auvipy deleted the py312 branch October 18, 2023 09:50
@auvipy
Copy link
Member Author

auvipy commented Oct 18, 2023

I think we got another similar change to do =================================== FAILURES ===================================
______________________ test_Hub.test__pop_ready_uses_lock ______________________

self = <t.unit.asynchronous.test_hub.test_Hub object at 0x7f6aacef6f30>

def test__pop_ready_uses_lock(self):
    with patch.object(self.hub, '_ready_lock', autospec=True) as lock:
        self.hub._pop_ready()
      assert lock.__enter__.called_once()

t/unit/asynchronous/test_hub.py:571:


self =
name = 'called_once'

def __getattr__(self, name):
    if name in {'_mock_methods', '_mock_unsafe'}:
        raise AttributeError(name)
    elif self._mock_methods is not None:
        if name not in self._mock_methods or name in _all_magics:
            raise AttributeError("Mock object has no attribute %r" % name)
    elif _is_magic(name):
        raise AttributeError(name)
    if not self._mock_unsafe and (not self._mock_methods or name not in self._mock_methods):
        if name.startswith(('assert', 'assret', 'asert', 'aseert', 'assrt')) or name in _ATTRIB_DENY_LIST:
          raise AttributeError(
                f"{name!r} is not a valid assertion. Use a spec "
                f"for the mock if {name!r} is meant to be an attribute.")

E AttributeError: 'called_once' is not a valid assertion. Use a spec for the mock if 'called_once' is meant to be an attribute.

#1813

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants