Skip to content

Commit

Permalink
Removing usage of patching for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
thedrow committed Oct 7, 2013
1 parent ff52587 commit efb9ff2
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 27 deletions.
Binary file modified .noseids
Binary file not shown.
11 changes: 2 additions & 9 deletions mockingbird/__init__.py
Expand Up @@ -46,13 +46,8 @@ def get_missing_properties(spec, obj):


def substitute(obj, qualified_name, spec):
testdouble = mock.patch(qualified_name, spec=spec, spec_set=True, new=obj)
testdouble.attribute_name = qualified_name

class FakesPatcher(object):
new = 1

def _new(*args, **kwargs):
def _new(*args, **kwargs):
return obj.__new__(obj)

def __enter__(self):
Expand All @@ -63,9 +58,7 @@ def __enter__(self):
def __exit__(self, exc_type, exc_val, exc_tb):
spec.__new__ = self._old_new

testdouble.additional_patchers.append(FakesPatcher())

return testdouble
return FakesPatcher()


def fake(obj):
Expand Down
2 changes: 1 addition & 1 deletion requirements/development.txt
@@ -1,4 +1,4 @@
pyformat>=0.3.3
pyformat>=0.5.0


-r ./common.txt
Expand Down
15 changes: 0 additions & 15 deletions tests/unit/fakes/test_fake.py
Expand Up @@ -26,19 +26,4 @@ class Configuration(object):
with case.assertRaisesRegexp(TestDoubleConfigurationError, 'The type to be faked was not specified.'):
fake(FakeObject)

@it.should('create a new patch object with the configured spec')
def test_should_create_a_new_mock_object_with_the_configured_spec(case):
class FakeObject(object):
class Configuration(object):
spec = RealObject

spec = FakeObject.Configuration().spec

with mock.patch('tests.common.compat.mock.patch') as m:
fake(FakeObject)

qualified_name = get_qualified_name(spec)

m.assert_called_once_with(qualified_name, spec=spec, spec_set=True, new=mock.ANY)

it.createTests(globals())
3 changes: 1 addition & 2 deletions tox.ini
Expand Up @@ -3,5 +3,4 @@ envlist = py26, py27, py32, py33, pypy

[testenv]
commands = nose2 -v --with-cov
deps =
-r {toxinidir}/requirements/development.txt
deps = -r {toxinidir}/requirements/development.txt

0 comments on commit efb9ff2

Please sign in to comment.