diff options
author | Robert Collins <robertc@robertcollins.net> | 2010-11-07 12:53:51 +1300 |
---|---|---|
committer | Robert Collins <robertc@robertcollins.net> | 2010-11-07 12:53:51 +1300 |
commit | e167e58c5743003a851f42759955da075e9425a6 (patch) | |
tree | d37c4af7ab4f776ea652d7e25640f0cc98f9502a /README | |
parent | dc383bbf68a676f16e712ac8fc2cb3c8f4001814 (diff) | |
download | fixtures-e167e58c5743003a851f42759955da075e9425a6.tar.gz |
Add a TempDir fixture.
Diffstat (limited to 'README')
-rw-r--r-- | README | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -99,6 +99,14 @@ puts the result of the function in fn_result:: True >>> fixture.cleanUp() +This can be expressed even more pithily: + + >>> fixture = fixtures.FunctionFixture(tempfile.mkdtemp, shutil.rmtree) + >>> fixture.setUp() + >>> print os.path.isdir(fixture.fn_result) + True + >>> fixture.cleanUp() + Another variation is is MethodFixture which is useful for adapting alternate fixture implementations to Fixture:: @@ -208,3 +216,10 @@ tests. >>> from StringIO import StringIO >>> fixture = fixtures.PopenFixture(lambda _:{'stdout': StringIO('foobar')}) + +TempDir ++++++++ + +Create a temporary directory and clean it up later. + + >>> fixture = fixtures.TempDir() |