Remove obsolete "importorskip('unittest.mock')" calls (#5608)
Remove obsolete "importorskip('unittest.mock')" calls
This commit is contained in:
commit
15e235c63e
|
@ -104,21 +104,15 @@ class TestMockDecoration:
|
||||||
values = getfuncargnames(f)
|
values = getfuncargnames(f)
|
||||||
assert values == ("x",)
|
assert values == ("x",)
|
||||||
|
|
||||||
@pytest.mark.xfail(
|
def test_getfuncargnames_patching(self):
|
||||||
strict=False, reason="getfuncargnames breaks if mock is imported"
|
|
||||||
)
|
|
||||||
def test_wrapped_getfuncargnames_patching(self):
|
|
||||||
from _pytest.compat import getfuncargnames
|
from _pytest.compat import getfuncargnames
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
def wrap(f):
|
class T:
|
||||||
def func():
|
def original(self, x, y, z):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func.__wrapped__ = f
|
@patch.object(T, "original")
|
||||||
func.patchings = ["qwe"]
|
|
||||||
return func
|
|
||||||
|
|
||||||
@wrap
|
|
||||||
def f(x, y, z):
|
def f(x, y, z):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -126,7 +120,6 @@ class TestMockDecoration:
|
||||||
assert values == ("y", "z")
|
assert values == ("y", "z")
|
||||||
|
|
||||||
def test_unittest_mock(self, testdir):
|
def test_unittest_mock(self, testdir):
|
||||||
pytest.importorskip("unittest.mock")
|
|
||||||
testdir.makepyfile(
|
testdir.makepyfile(
|
||||||
"""
|
"""
|
||||||
import unittest.mock
|
import unittest.mock
|
||||||
|
@ -142,7 +135,6 @@ class TestMockDecoration:
|
||||||
reprec.assertoutcome(passed=1)
|
reprec.assertoutcome(passed=1)
|
||||||
|
|
||||||
def test_unittest_mock_and_fixture(self, testdir):
|
def test_unittest_mock_and_fixture(self, testdir):
|
||||||
pytest.importorskip("unittest.mock")
|
|
||||||
testdir.makepyfile(
|
testdir.makepyfile(
|
||||||
"""
|
"""
|
||||||
import os.path
|
import os.path
|
||||||
|
@ -164,7 +156,6 @@ class TestMockDecoration:
|
||||||
reprec.assertoutcome(passed=1)
|
reprec.assertoutcome(passed=1)
|
||||||
|
|
||||||
def test_unittest_mock_and_pypi_mock(self, testdir):
|
def test_unittest_mock_and_pypi_mock(self, testdir):
|
||||||
pytest.importorskip("unittest.mock")
|
|
||||||
pytest.importorskip("mock", "1.0.1")
|
pytest.importorskip("mock", "1.0.1")
|
||||||
testdir.makepyfile(
|
testdir.makepyfile(
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue