From 449b78efaa4c89453ec7eac8d326650c2c05de63 Mon Sep 17 00:00:00 2001 From: Emil Mikulic Date: Sun, 17 Apr 2011 19:01:52 +1000 Subject: [PATCH] Use setUp and tearDown to manage test file. --- devel/test.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/devel/test.py b/devel/test.py index ad6163c..8aedb4d 100755 --- a/devel/test.py +++ b/devel/test.py @@ -72,13 +72,15 @@ class TestHelper(unittest.TestCase): 'Generated by darkhttpd') class TestDirList(TestHelper): + def setUp(self): + self.fn = WWWROOT+"/escape#this" + open(self.fn, "w").write("x"*12345) + + def tearDown(self): + os.unlink(self.fn) + def test_dirlist_escape(self): - fn = WWWROOT+"/escape#this" - open(fn, "w").write("x"*12345) - try: - resp = Conn().get("/") - finally: - os.unlink(fn) + resp = Conn().get("/") status, hdrs, body = parse(resp) self.assertEquals(ord("#"), 0x23) self.assertContains(body, "escape%23this", "12345")