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
4.0.x: 'ValueError: Sentinels must not start with _' and others #487
Comments
Example 2:
|
We are seeing something similar: Captured traceback:
|
testing-cabal/mock#487 Change-Id: I1da8453a5e838a3f9cc730655a3d9d8519d55f36
* Update requirements from branch 'master' - blacklist bad mock releases 4.0.0 and 4.0.1 testing-cabal/mock#487 Change-Id: I1da8453a5e838a3f9cc730655a3d9d8519d55f36
@2uasimojo Please add a note on the version of Python. mock 4.0 added support to detect coroutines to return AsyncMock. It's trying to detect it by getting _is_coroutine. oslotest tries to do autospec and has a restriction that getattr cannot be used with _is_coroutine. From the traceback if you are on Python 3.7 this is something that might affect your upgrade to 3.8 too. So in one way I see at as an upstream issue that is detected by the backport. |
@johnsom Please add a simplified reproducer for the issue on how to reproduce the failure. From the traceback yours seem to be a different issue. Thanks. |
The issue reported by @johnsom can be reproduced as below. Please correct me if I understood the issue incorrectly.
In upstream cpython mock with 3.7 there is no error. In Python 3.8 and master it triggers ValueError. The cause in both issues reported is that we rely on getattr to detect coroutine that might have side effects that were not present before. Both will be upstream issues when the projects upgrade to 3.8. I am not sure of a way to get the attribute without triggering the side effect of getattr that could possibly solve the issue. |
@2uasimojo / @johnsom - thanks for the reports, but these are separate issues and would have been better filed as such. @tirkarthi - thanks for the digging! Sounds like these are all upstream issues and so will be need to be reported and fixed there so they can be backported. @2uasimojo / @johnsom - please can you report these issues on https://bugs.python.org/, and file each one separately. Feel free to ping the bpo urls here when you have them, and and PRs, so that I can get a new backport release out as soon as the fixes land on cpython master. |
I think the original issue reported here ('ValueError: Sentinels must not start with _') caused by the violation of the getattr protocol in oslo utils [1]. I filed a bug in oslo utils [2] and bushed a fix [3]. [1] https://github.com/openstack/oslo.utils/blob/b9938230f992935e8332b6e288937be890724cd2/oslo_utils/fixture.py#L82 |
With 4.0.0 and 4.0.1, tests start failing in several OpenStack projects. Example 1:
(permalink to that source line: https://opendev.org/openstack/nova/src/commit/e69dbfa0d34d6b3f51282ac0ab51cdab3c2115e4/nova/tests/unit/virt/libvirt/test_host.py#L589)
Switching from
import mock
tofrom unittest import mock
fixes this one.We will add comments with other examples.
The text was updated successfully, but these errors were encountered: