Python 3.10 mock errors

Bug #1954476 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tap-as-a-service
Fix Released
Undecided
Unassigned

Bug Description

'tox -e py310' results in several errors such as:

======================================================================
FAIL: neutron_taas.tests.unit.services.taas.test_taas_plugin.TestTaasPlugin.test_create_tap_flow
neutron_taas.tests.unit.services.taas.test_taas_plugin.TestTaasPlugin.test_create_tap_flow
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/neutron_taas/tests/unit/services/taas/test_taas_plugin.py", line 44, in setUp
    mock.patch.object(n_rpc, 'Connection', auto_spec=True).start()
  File "/usr/lib/python3.10/unittest/mock.py", line 1635, in _patch_object
    return _patch(
  File "/usr/lib/python3.10/unittest/mock.py", line 1285, in __init__
    _check_spec_arg_typos(kwargs)
  File "/usr/lib/python3.10/unittest/mock.py", line 1261, in _check_spec_arg_typos
    raise RuntimeError(
RuntimeError: 'auto_spec' might be a typo; use unsafe=True if this is intended

A similar issue is being fixed in ironic at https://review.opendev.org/c/openstack/ironic/+/821370

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tap-as-a-service (master)
Changed in tap-as-a-service:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tap-as-a-service (master)

Reviewed: https://review.opendev.org/c/openstack/tap-as-a-service/+/821445
Committed: https://opendev.org/openstack/tap-as-a-service/commit/7eaf7dfebb428544056877bfe5aaaab6c582f5ca
Submitter: "Zuul (22348)"
Branch: master

commit 7eaf7dfebb428544056877bfe5aaaab6c582f5ca
Author: Corey Bryant <email address hidden>
Date: Fri Dec 10 14:10:11 2021 -0500

    Switch away from Mock auto_spec=True

    In Python 3.10, Mock spec arguments are no longer allowed.
    More details are available at: https://bugs.python.org/issue43478

    Closes-Bug: #1954476
    Change-Id: I98c3d6d67ba518f9c6c3455e9c5b0e2ea669a2f6

Changed in tap-as-a-service:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tap-as-a-service 11.0.0.0rc1

This issue was fixed in the openstack/tap-as-a-service 11.0.0.0rc1 release candidate.

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.