Skip to content

fix Python mockito to 1.3.0 #3984

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

Merged
merged 3 commits into from
Jul 5, 2022
Merged

Conversation

vladak
Copy link
Member

@vladak vladak commented Jul 5, 2022

Recently the Python tests started failing in test_headers_timeout_requests() because of:

>       if r.status_code == 202:
E       AttributeError: 'Dummy' has no attribute 'status_code' configured

This change should address that by fixing mockito to 1.3.0 which worked:

>>> import requests
>>> from mockito import mock
>>> m = mock(spec=requests.Response)
>>> m.__
m.__call__(           m.__dir__(            m.__ge__(             m.__hash__(           m.__lt__(             m.__reduce__(         m.__sizeof__(         
m.__class__(          m.__doc__             m.__getattr__(        m.__init__(           m.__module__          m.__reduce_ex__(      m.__str__(            
m.__delattr__(        m.__eq__(             m.__getattribute__(   m.__init_subclass__(  m.__ne__(             m.__repr__(           m.__subclasshook__(   
m.__dict__            m.__format__(         m.__gt__(             m.__le__(             m.__new__(            m.__setattr__(        m.__weakref__         
>>> m.__dict__
{}
>>> m.status_code
functools.partial(<function remembered_invocation_builder at 0x107096790>, <mockito.mocking.Mock object at 0x1063ebe80>, 'status_code')
>>> 

In 1.3.2 there was some change:

>>> from mockito import mock
>>> import requests
>>> m = mock(spec=requests.Response)
>>> m.status_code
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/private/tmp/venv/lib/python3.9/site-packages/mockito/mocking.py", line 289, in __getattr__
    raise AttributeError(
AttributeError: 'Dummy' has no attribute 'status_code' configured

@vladak vladak added tools Python tools testing labels Jul 5, 2022
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jul 5, 2022
@vladak vladak changed the title add status_code to the Response mock fix Python mockito to 1.3.0 Jul 5, 2022
@vladak vladak merged commit 035a7b7 into oracle:master Jul 5, 2022
@vladak vladak deleted the tools_response_status_mock branch July 5, 2022 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement. testing tools Python tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant