Message7849
Hi Ralf:
In message <1698143743.33.0.829120522093.issue2551296@roundup.psfhosted.org>,
Ralf Schlatterbeck writes:
>New submission from Ralf Schlatterbeck:
>
>test/test_hyperdbvals.py has
>
>from mock import Mock
>
>in the commit
>changeset: 7212:76a21cf791b9
>
>Where do I get this from?
>My standard python 3.11.2 (debian stable aka bookworm) doesn't have it:
[...]
>But it seems to be in unittest:
>
>>>> from unittest.mock import Mock
>>>>
>
>But I'm unsure if this is the same thing.
For python 3.6 (debian 18.04) mock is
/usr/lib/python3/dist-packages/mock/mock.py
and starts:
# mock 1.0.1
# http://www.voidspace.org.uk/python/mock/
#
# Copyright (c) 2007-2013, Michael Foord & the mock team
and diffing it against /usr/lib/python3.6/unittest/mock.py which starts:
# mock.py
# Test tools for mocking and patching.
# Maintained by Michael Foord
# Backport for other versions of Python available from
# https://pypi.org/project/mock
makes it look like unittest/mock.py is just a different version of
mock/mock.py.
However there is no mock in unittest under my python2.7.
I have changed that import to read:
try:
from unittest.mock import Mock
except ImportError:
# python 2.7
from mock import Mock
and successfully run that test module under python2.7 and 3.6.
Committed in changeset: 7670:a28ea83ace86 |
|
Date |
User |
Action |
Args |
2023-10-24 13:24:27 | rouilj | set | recipients:
+ rouilj, schlatterbeck |
2023-10-24 13:24:27 | rouilj | link | issue2551296 messages |
2023-10-24 13:24:27 | rouilj | create | |
|