launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #04462
Re: Lighter tests with FakeLibrarian
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 08/24/2010 03:07 PM, Robert Collins wrote:
> Awesome Jeroen, thank you for doing this.
>
> I have a suggestion for a small minor incremental improvement.
>
> It would be nice to be able to use
> self.installFixture(FakeLibrarian())
Nah, it would be nice to be able to use
self.useContext(FakeLibrarian())
> All you need for that is for the fake to support setUp and tearDown.
All you need for that is for the fake to support __enter__ and __exit__.
That also lets you use
with FakeLibrarian():
blah
and decorate_with:
@decorate_with(FakeLibrarian)
def test_myMethod()
And everything out of contextlib, etc.
Cheers,
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkx0HW0ACgkQ0F+nu1YWqI2nqACcCK8Hh/iNd1BbjQQ3D/2fdLlb
CIkAn18v1BVcEcgH/p9/rmWo7LYXH5Kc
=sfYZ
-----END PGP SIGNATURE-----
Follow ups
References