|
|
5f89d2f |
From a72ebc3afb3301383497159abb8327aeec59494f Mon Sep 17 00:00:00 2001
|
|
|
5f89d2f |
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
|
|
5f89d2f |
Date: Wed, 6 Jan 2021 13:15:18 +0100
|
|
|
5f89d2f |
Subject: [PATCH] Fix a typo in autospec
|
|
|
5f89d2f |
|
|
|
5f89d2f |
On Python 3.10, I get:
|
|
|
5f89d2f |
|
|
|
5f89d2f |
=================================== FAILURES ===================================
|
|
|
5f89d2f |
_____________________ test_info_setup_complex_pep517_error _____________________
|
|
|
5f89d2f |
|
|
|
5f89d2f |
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f31e2e772b0>
|
|
|
5f89d2f |
demo_setup_complex = PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_info_setup_complex_pep5170')
|
|
|
5f89d2f |
|
|
|
5f89d2f |
def test_info_setup_complex_pep517_error(mocker, demo_setup_complex):
|
|
|
5f89d2f |
> mocker.patch(
|
|
|
5f89d2f |
"poetry.utils.env.VirtualEnv.run",
|
|
|
5f89d2f |
auto_spec=True,
|
|
|
5f89d2f |
side_effect=EnvCommandError(CalledProcessError(1, "mock", output="mock")),
|
|
|
5f89d2f |
)
|
|
|
5f89d2f |
|
|
|
5f89d2f |
tests/inspection/test_info.py:191:
|
|
|
5f89d2f |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
5f89d2f |
/usr/lib/python3.10/site-packages/pytest_mock/plugin.py:376: in __call__
|
|
|
5f89d2f |
return self._start_patch(
|
|
|
5f89d2f |
/usr/lib/python3.10/site-packages/pytest_mock/plugin.py:184: in _start_patch
|
|
|
5f89d2f |
p = mock_func(*args, **kwargs)
|
|
|
5f89d2f |
/usr/lib64/python3.10/unittest/mock.py:1736: in patch
|
|
|
5f89d2f |
return _patch(
|
|
|
5f89d2f |
/usr/lib64/python3.10/unittest/mock.py:1275: in __init__
|
|
|
5f89d2f |
_check_spec_arg_typos(kwargs)
|
|
|
5f89d2f |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
5f89d2f |
|
|
|
5f89d2f |
kwargs_to_check = {'auto_spec': True, 'side_effect': EnvCommandError('Command mock errored with the following return code 1, and output: \nmock')}
|
|
|
5f89d2f |
|
|
|
5f89d2f |
def _check_spec_arg_typos(kwargs_to_check):
|
|
|
5f89d2f |
typos = ("autospect", "auto_spec", "set_spec")
|
|
|
5f89d2f |
for typo in typos:
|
|
|
5f89d2f |
if typo in kwargs_to_check:
|
|
|
5f89d2f |
> raise RuntimeError(
|
|
|
5f89d2f |
f"{typo!r} might be a typo; use unsafe=True if this is intended"
|
|
|
5f89d2f |
)
|
|
|
5f89d2f |
E RuntimeError: 'auto_spec' might be a typo; use unsafe=True if this is intended
|
|
|
5f89d2f |
|
|
|
5f89d2f |
/usr/lib64/python3.10/unittest/mock.py:1251: RuntimeError
|
|
|
5f89d2f |
---
|
|
|
5f89d2f |
tests/inspection/test_info.py | 2 +-
|
|
|
5f89d2f |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
5f89d2f |
|
|
|
5f89d2f |
diff --git a/tests/inspection/test_info.py b/tests/inspection/test_info.py
|
|
|
5f89d2f |
index e04bd52a5..ac0c4504e 100644
|
|
|
5f89d2f |
--- a/tests/inspection/test_info.py
|
|
|
5f89d2f |
+++ b/tests/inspection/test_info.py
|
|
|
5f89d2f |
@@ -174,7 +174,7 @@ def test_info_setup_complex(demo_setup_complex):
|
|
|
5f89d2f |
def test_info_setup_complex_pep517_error(mocker, demo_setup_complex):
|
|
|
5f89d2f |
mocker.patch(
|
|
|
5f89d2f |
"poetry.utils.env.VirtualEnv.run",
|
|
|
5f89d2f |
- auto_spec=True,
|
|
|
5f89d2f |
+ autospec=True,
|
|
|
5f89d2f |
side_effect=EnvCommandError(CalledProcessError(1, "mock", output="mock")),
|
|
|
5f89d2f |
)
|
|
|
5f89d2f |
|