unittest.mock from stdlib should come last
--HG-- branch : mock-unittest-252
This commit is contained in:
parent
e6ad6e02d2
commit
2e55c4ba61
|
@ -1866,8 +1866,10 @@ def handle_mock_module_patching(function, startindex):
|
||||||
Special treatment when test_function is decorated
|
Special treatment when test_function is decorated
|
||||||
by mock.patch
|
by mock.patch
|
||||||
"""
|
"""
|
||||||
for candidate_module_name in ('unittest.mock', 'mock'):
|
for candidate_module_name in ('mock', 'unittest.mock'):
|
||||||
# stdlib comes first
|
# stdlib comes last, because mock might be also installed
|
||||||
|
# as a third party with upgraded version compare to
|
||||||
|
# unittest.mock
|
||||||
try:
|
try:
|
||||||
mock = sys.modules[candidate_module_name]
|
mock = sys.modules[candidate_module_name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
Loading…
Reference in New Issue