functional tests stable/stein and older: TypeError: name must be a str, not a MagicMock

Bug #1867634 reported by Flavio Fernandes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ovsdbapp
Fix Released
Medium
Terry Wilson

Bug Description

ovsdbapp.git on stable/stein

```
$ tox -v -e functional

...
==============================
Failed 2 tests - output below:
==============================

ovsdbapp.tests.functional.schema.open_vswitch.test_impl_idl.ImplIdlTestCase.test_post_commit_vswitchd_completed_no_failures
---------------------------------------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/ovsdbapp/tests/functional/schema/open_vswitch/test_impl_idl.py", line 168, in setUp'
    b' autospec=True).start()'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 1500, in start'
    b' result = self.__enter__()'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 1450, in __enter__'
    b' _name=self.attribute, **kwargs)'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 2368, in create_autospec'
    b' **kwargs)'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 1963, in __init__'
    b' _safe_super(MagicMixin, self).__init__(*args, **kw)'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 1047, in __init__'
    b' _spec_state, _new_name, _new_parent, **kwargs'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 517, in __init__'
    b' self._mock_add_spec(spec, spec_set, _spec_as_instance, _eat_self)'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 574, in _mock_add_spec'
    b' _spec_as_instance, _eat_self)'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 197, in _get_signature_object'
    b' return func, inspectsignature(sig_func)'
    b' File "/usr/lib/python3.6/inspect.py", line 3065, in signature'
    b' return Signature.from_callable(obj, follow_wrapped=follow_wrapped)'
    b' File "/usr/lib/python3.6/inspect.py", line 2815, in from_callable'
    b' follow_wrapper_chains=follow_wrapped)'
    b' File "/usr/lib/python3.6/inspect.py", line 2269, in _signature_from_callable'
    b' return _signature_from_function(sigcls, obj)'
    b' File "/usr/lib/python3.6/inspect.py", line 2153, in _signature_from_function'
    b' kind=_VAR_POSITIONAL))'
    b' File "/usr/lib/python3.6/inspect.py", line 2470, in __init__'
    b' raise TypeError(msg)'
    b'TypeError: name must be a str, not a MagicMock'
    b''

ovsdbapp.tests.functional.schema.open_vswitch.test_impl_idl.ImplIdlTestCase.test_post_commit_vswitchd_incomplete_timeout
------------------------------------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/ovsdbapp/tests/functional/schema/open_vswitch/test_impl_idl.py", line 168, in setUp'
    b' autospec=True).start()'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 1500, in start'
    b' result = self.__enter__()'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 1450, in __enter__'
    b' _name=self.attribute, **kwargs)'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 2368, in create_autospec'
    b' **kwargs)'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 1963, in __init__'
    b' _safe_super(MagicMixin, self).__init__(*args, **kw)'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 1047, in __init__'
    b' _spec_state, _new_name, _new_parent, **kwargs'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 517, in __init__'
    b' self._mock_add_spec(spec, spec_set, _spec_as_instance, _eat_self)'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 574, in _mock_add_spec'
    b' _spec_as_instance, _eat_self)'
    b' File "/home/ffernand/work/openstack/ovsdbapp.git/.tox/functional/lib/python3.6/site-packages/mock/mock.py", line 197, in _get_signature_object'
    b' return func, inspectsignature(sig_func)'
    b' File "/usr/lib/python3.6/inspect.py", line 3065, in signature'
    b' return Signature.from_callable(obj, follow_wrapped=follow_wrapped)'
    b' File "/usr/lib/python3.6/inspect.py", line 2815, in from_callable'
    b' follow_wrapper_chains=follow_wrapped)'
    b' File "/usr/lib/python3.6/inspect.py", line 2269, in _signature_from_callable'
    b' return _signature_from_function(sigcls, obj)'
    b' File "/usr/lib/python3.6/inspect.py", line 2153, in _signature_from_function'
    b' kind=_VAR_POSITIONAL))'
    b' File "/usr/lib/python3.6/inspect.py", line 2470, in __init__'
    b' raise TypeError(msg)'
    b'TypeError: name must be a str, not a MagicMock'
    b''

======
Totals
======
Ran: 228 tests in 1.5645 sec.
 - Passed: 226
 - Skipped: 0
 - Expected Fail: 0
 - Unexpected Success: 0
 - Failed: 2
Sum of execute time for each test: 5.7354 sec.
```

Revision history for this message
Flavio Fernandes (ffernand) wrote :

Caveat:

When the failed tests are ran by themselves, then it does NOT fail:

tox -v -e functional -- \
ovsdbapp.tests.functional.schema.open_vswitch.test_impl_idl.ImplIdlTestCase.test_post_commit_vswitchd_incomplete_timeout

tox -v -e functional -- \
ovsdbapp.tests.functional.schema.open_vswitch.test_impl_idl.ImplIdlTestCase.test_post_commit_vswitchd_completed_no_failures

Running both tests together will fail ovsdbapp.tests.functional.schema.open_vswitch.test_impl_idl.ImplIdlTestCase.test_post_commit_vswitchd_incomplete_timeout independent of the order :

tox -v -e functional -- \
ovsdbapp.tests.functional.schema.open_vswitch.test_impl_idl.ImplIdlTestCase.test_post_commit_vswitchd_incomplete_timeout \
ovsdbapp.tests.functional.schema.open_vswitch.test_impl_idl.ImplIdlTestCase.test_post_commit_vswitchd_completed_no_failures

tox -v -e functional -- \
ovsdbapp.tests.functional.schema.open_vswitch.test_impl_idl.ImplIdlTestCase.test_post_commit_vswitchd_completed_no_failures \
ovsdbapp.tests.functional.schema.open_vswitch.test_impl_idl.ImplIdlTestCase.test_post_commit_vswitchd_incomplete_timeout

Changed in ovsdbapp:
assignee: nobody → Terry Wilson (otherwiseguy)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ovsdbapp (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/717142

Changed in ovsdbapp:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ovsdbapp (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.opendev.org/717261

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ovsdbapp (stable/queens)

Fix proposed to branch: stable/queens
Review: https://review.opendev.org/717264

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ovsdbapp (stable/stein)

Reviewed: https://review.opendev.org/717142
Committed: https://git.openstack.org/cgit/openstack/ovsdbapp/commit/?id=b22e1c4e43ca4f095bff8cb228ef83dd1474a403
Submitter: Zuul
Branch: stable/stein

commit b22e1c4e43ca4f095bff8cb228ef83dd1474a403
Author: Terry Wilson <email address hidden>
Date: Thu Apr 2 17:57:38 2020 -0500

    Unbreak mock-releated autospec issue

    For some reason, in stable/stein and older, the autospec=True in
    this test started failing. Using python3's unittest.mock works, so
    just to get this working use that if it exists.

    Change-Id: I508bc07754f11165fb50f5f3f412f6191d27f8b4
    Closes-bug: #1867634

tags: added: in-stable-stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on ovsdbapp (stable/rocky)

Change abandoned by Flavio Fernandes (<email address hidden>) on branch: stable/rocky
Review: https://review.opendev.org/717261
Reason: Abandoning support for these changes on stable/rocky.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ovsdbapp (stable/queens)

Reviewed: https://review.opendev.org/717264
Committed: https://git.openstack.org/cgit/openstack/ovsdbapp/commit/?id=460abdbef808c3d0c4bf9e8f8f33f430cf52df58
Submitter: Zuul
Branch: stable/queens

commit 460abdbef808c3d0c4bf9e8f8f33f430cf52df58
Author: Terry Wilson <email address hidden>
Date: Thu Apr 2 17:57:38 2020 -0500

    Unbreak mock-releated autospec issue

    For some reason, in stable/stein and older, the autospec=True in
    this test started failing. Using python3's unittest.mock works, so
    just to get this working use that if it exists.

    Also adding basepython to python2 via tox.ini to keep pep8 working
    in stable/queens.

    Change-Id: I508bc07754f11165fb50f5f3f412f6191d27f8b4
    Closes-bug: #1867634

tags: added: in-stable-queens
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ovsdbapp (stable/rocky)

Reviewed: https://review.opendev.org/717261
Committed: https://git.openstack.org/cgit/openstack/ovsdbapp/commit/?id=45057e3fb1e9c1cf3c66382e7cf21c5ac5f2b136
Submitter: Zuul
Branch: stable/rocky

commit 45057e3fb1e9c1cf3c66382e7cf21c5ac5f2b136
Author: Terry Wilson <email address hidden>
Date: Thu Apr 2 17:57:38 2020 -0500

    Unbreak mock-releated autospec issue

    For some reason, in stable/stein and older, the autospec=True in
    this test started failing. Using python3's unittest.mock works, so
    just to get this working use that if it exists.

    Change-Id: I508bc07754f11165fb50f5f3f412f6191d27f8b4
    Closes-bug: #1867634

tags: added: in-stable-rocky
Changed in ovsdbapp:
status: Confirmed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ovsdbapp queens-eol

This issue was fixed in the openstack/ovsdbapp queens-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ovsdbapp rocky-eol

This issue was fixed in the openstack/ovsdbapp rocky-eol release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.