fix issue473: work around mock putting an unbound method into a class

dict when double-patching.

--HG--
branch : issue473
This commit is contained in:
holger krekel
2014-04-08 12:50:13 +02:00
parent ef7cb47b1e
commit f91049cec9
3 changed files with 20 additions and 0 deletions

View File

@@ -164,6 +164,21 @@ class TestMockDecoration:
names = [x.nodeid.split("::")[-1] for x in calls]
assert names == ["test_one", "test_two", "test_three"]
def test_mock_double_patch_issue473(self, testdir):
testdir.makepyfile("""
from mock import patch
from pytest import mark
@patch('os.getcwd')
@patch('os.path')
@mark.slow
class TestSimple:
def test_simple_thing(self, mock_path, mock_getcwd):
pass
""")
res = testdir.inline_run()
res.assertoutcome(passed=1)
class TestReRunTests:
def test_rerun(self, testdir):