Your message dated Thu, 13 Jan 2022 15:49:18 +0000
with message-id <e1n82lm-000ieu...@fasolo.debian.org>
and subject line Bug#1001422: fixed in python-mock 4.0.3-3
has caused the Debian Bug report #1001422,
regarding python-mock: (autopkgtest) needs update for python3.10:
InvalidSpecError
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)
--
1001422: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1001422
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Source: python-mock
Version: 4.0.3-2
Severity: serious
X-Debbugs-CC: debian...@lists.debian.org
Tags: sid bookworm
User: debian...@lists.debian.org
Usertags: needs-update
User: debian-pyt...@lists.debian.org
Usertags: python3.10
Control: affects -1 src:python3-defaults
Dear maintainer(s),
We are in the transition of adding python3.10 to the supported Python
versions [0]. With a recent upload of python3-defaults the autopkgtest
of python-mock fails in testing when that autopkgtest is run with the
binary packages of python3-defaults from unstable. It passes when run
with only packages from testing. In tabular form:
pass fail
python3-defaults from testing 3.9.8-1
python-mock from testing 4.0.3-2
all others from testing from testing
I copied some of the output at the bottom of this report.
Currently this regression is blocking the migration of python3-defaults
to testing [1]. https://docs.python.org/3/whatsnew/3.10.html lists
what's new in Python3.10, it may help to identify what needs to be updated.
More information about this bug and the reason for filing it can be found on
https://wiki.debian.org/ContinuousIntegration/RegressionEmailInformation
Paul
[0] https://bugs.debian.org/996584
[1] https://qa.debian.org/excuses.php?package=python3-defaults
https://ci.debian.net/data/autopkgtest/testing/amd64/p/python-mock/17420659/log.gz
=================================== FAILURES
===================================
_____________ MockTest.test_bool_not_called_when_passing_spec_arg
______________
self = <mock.tests.testmock.MockTest
testMethod=test_bool_not_called_when_passing_spec_arg>
def test_bool_not_called_when_passing_spec_arg(self):
class Something:
def __init__(self):
self.obj_with_bool_func = unittest.mock.MagicMock()
obj = Something()
with unittest.mock.patch.object(obj, 'obj_with_bool_func',
autospec=True): pass
/usr/lib/python3/dist-packages/mock/tests/testmock.py:2176: _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <unittest.mock._patch object at 0x7fe190485180>
def __enter__(self):
"""Perform the patch."""
new, spec, spec_set = self.new, self.spec, self.spec_set
autospec, kwargs = self.autospec, self.kwargs
new_callable = self.new_callable
self.target = self.getter()
# normalise False to None
if spec is False:
spec = None
if spec_set is False:
spec_set = None
if autospec is False:
autospec = None
if spec is not None and autospec is not None:
raise TypeError("Can't specify spec and autospec")
if ((spec is not None or autospec is not None) and
spec_set not in (True, None)):
raise TypeError("Can't provide explicit spec_set *and* spec
or autospec")
original, local = self.get_original()
if new is DEFAULT and autospec is None:
inherit = False
if spec is True:
# set spec to the object we are replacing
spec = original
if spec_set is True:
spec_set = original
spec = None
elif spec is not None:
if spec_set is True:
spec_set = spec
spec = None
elif spec_set is True:
spec_set = original
if spec is not None or spec_set is not None:
if original is DEFAULT:
raise TypeError("Can't use 'spec' with create=True")
if isinstance(original, type):
# If we're patching out a class and there is a spec
inherit = True
if spec is None and _is_async_obj(original):
Klass = AsyncMock
else:
Klass = MagicMock
_kwargs = {}
if new_callable is not None:
Klass = new_callable
elif spec is not None or spec_set is not None:
this_spec = spec
if spec_set is not None:
this_spec = spec_set
if _is_list(this_spec):
not_callable = '__call__' not in this_spec
else:
not_callable = not callable(this_spec)
if _is_async_obj(this_spec):
Klass = AsyncMock
elif not_callable:
Klass = NonCallableMagicMock
if spec is not None:
_kwargs['spec'] = spec
if spec_set is not None:
_kwargs['spec_set'] = spec_set
# add a name to mocks
if (isinstance(Klass, type) and
issubclass(Klass, NonCallableMock) and self.attribute):
_kwargs['name'] = self.attribute
_kwargs.update(kwargs)
new = Klass(**_kwargs)
if inherit and _is_instance_mock(new):
# we can only tell if the instance should be callable
if the
# spec is not a list
this_spec = spec
if spec_set is not None:
this_spec = spec_set
if (not _is_list(this_spec) and not
_instance_callable(this_spec)):
Klass = NonCallableMagicMock
_kwargs.pop('name')
new.return_value = Klass(_new_parent=new, _new_name='()',
**_kwargs)
elif autospec is not None:
# spec is ignored, new *must* be default, spec_set is treated
# as a boolean. Should we check spec is not None and that
spec_set
# is a bool?
if new is not DEFAULT:
raise TypeError(
"autospec creates the mock for you. Can't specify "
"autospec and new."
)
if original is DEFAULT:
raise TypeError("Can't use 'autospec' with create=True")
spec_set = bool(spec_set)
if autospec is True:
autospec = original
if _is_instance_mock(self.target):
raise InvalidSpecError(
f'Cannot autospec attr {self.attribute!r} as the
patch '
f'target has already been mocked out. '
f'[target={self.target!r}, attr={autospec!r}]')
if _is_instance_mock(autospec):
target_name = getattr(self.target, '__name__', self.target)
raise InvalidSpecError(
f'Cannot autospec attr {self.attribute!r} from target '
f'{target_name!r} as it has already been mocked out. '
f'[target={self.target!r}, attr={autospec!r}]')
E unittest.mock.InvalidSpecError: Cannot autospec attr
'obj_with_bool_func' from target
<mock.tests.testmock.MockTest.test_bool_not_called_when_passing_spec_arg.<locals>.Something
object at 0x7fe1903ef9d0> as it has already been mocked out.
[target=<mock.tests.testmock.MockTest.test_bool_not_called_when_passing_spec_arg.<locals>.Something
object at 0x7fe1903ef9d0>, attr=<MagicMock id='140606764414624'>]
/usr/lib/python3.10/unittest/mock.py:1528: InvalidSpecError
OpenPGP_signature
Description: OpenPGP digital signature
--- End Message ---
--- Begin Message ---
Source: python-mock
Source-Version: 4.0.3-3
Done: Michael Fladischer <fl...@debian.org>
We believe that the bug you reported is fixed in the latest version of
python-mock, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 1001...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Michael Fladischer <fl...@debian.org> (supplier of updated python-mock package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Format: 1.8
Date: Thu, 13 Jan 2022 15:21:45 +0000
Source: python-mock
Architecture: source
Version: 4.0.3-3
Distribution: unstable
Urgency: medium
Maintainer: Debian Python Team <team+pyt...@tracker.debian.org>
Changed-By: Michael Fladischer <fl...@debian.org>
Closes: 1001422 1002345
Changes:
python-mock (4.0.3-3) unstable; urgency=medium
.
* Depend on python3-all for autopkgtests.
* Add upstream patch to fix tests that should test mock but were
testing unittest.mock (Closes: #1001422, #1002345).
* Update year in d/copyright.
Checksums-Sha1:
6cc1de1b5586d93c81287cf5e7c035164b5f3370 1920 python-mock_4.0.3-3.dsc
4b7b9c7bdc62712c9402870e98beb5f5bcca5fd8 7604 python-mock_4.0.3-3.debian.tar.xz
3c05b1b0aa590bbc4b54fb962724de998fd19043 7823
python-mock_4.0.3-3_arm64.buildinfo
Checksums-Sha256:
1c14aa39a8314e89f4e4c38e7eb4d1cc9cd53ba81e6ca3190b8ae7687c211713 1920
python-mock_4.0.3-3.dsc
cd59a91ab0b8f06954a21529b4c3ec86fa5f1fa6da836ebd1139fb8a8e8d093a 7604
python-mock_4.0.3-3.debian.tar.xz
6c93558909545bcd862dcc9b1e6018c24bb361e7fd6b20db9a2935ce7226f318 7823
python-mock_4.0.3-3_arm64.buildinfo
Files:
a67bf4a07ca87f251ccb0da9c3767297 1920 python optional python-mock_4.0.3-3.dsc
d9bc36b3aa4fd2d713df83551cfb55f9 7604 python optional
python-mock_4.0.3-3.debian.tar.xz
2ae92bf91f2e627c6b41bc537700d917 7823 python optional
python-mock_4.0.3-3_arm64.buildinfo
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCgAdFiEEqVSlRXW87UkkCnJc/9PIi5l90WoFAmHgRK8ACgkQ/9PIi5l9
0WpONgf/Sfe8ofG1ZI/W7oaZ1ZslEX+7qjOqwmVgMmmW1aTKH4TDGA+nqpamI5EV
k8aBQL3EcQ+54D0q4JdX86Pt0zr4dMrxFO13voOnU/sG9LI+zLchiakHRMq4ihxM
DZYX8zsQxFzM3hdT7A/CQ/XGJeQhcmfI8OzEt9x2iedGO+cZ043v8J51rnt+JAUo
naekiE/AIXDpbPiyEsg+MZ0QZtmT3/fS5Z8CmcIbHSsNLSeDoGD8DYE6evDVSwEG
ZMj8ryWIPz778O3I31wjQAslOitdyJK9BxPXGihAeCidI0R1zA1OERi+kl2uB6BJ
PsrlPbsYm7E+D+nTcZRjrtitWvwK7g==
=sjfH
-----END PGP SIGNATURE-----
--- End Message ---