<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -4,9 +4,7 @@
 *.swp
 *.pyc
 .DS_Store
-PYSMELLTAGS
 PYSMELLTAGS.*
-OUTPUTREDIR*
 build
 dist
 pysmell.egg-info</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,22 @@ import os
 from pysmell import idehelper
 from pysmell import __version__ as version
 
+class ProducesFile(object):
+    def __init__(self, *files):
+        self.files = files
+    def __call__(self, func):
+        def patched(*args, **kw):
+            for f in self.files:
+                if os.path.exists(f):
+                    os.remove(f)
+            try:
+                return func(*args, **kw)
+            finally:
+                for f in self.files:
+                    if os.path.exists(f):
+                        os.remove(f)
+        return patched
+
 class FunctionalTest(unittest.TestCase):
     def setUp(self):
         self.packageA = {
@@ -87,9 +103,8 @@ class FunctionalTest(unittest.TestCase):
                 self.assertEquals(value, expectedDict[key], &quot;wrong value for key %s: %s&quot; % (key, value)) 
 
 
+    @ProducesFile('TestData/PYSMELLTAGS')
     def testMultiPackage(self):
-        if os.path.exists('TestData/PYSMELLTAGS'):
-            os.remove('TestData/PYSMELLTAGS')
         subprocess.call([&quot;pysmell&quot;, &quot;PackageA&quot;, &quot;PackageB&quot;], cwd='TestData')
         self.assertTrue(os.path.exists('TestData/PYSMELLTAGS'))
         PYSMELLDICT = eval(open('TestData/PYSMELLTAGS').read())
@@ -102,9 +117,8 @@ class FunctionalTest(unittest.TestCase):
         self.assertDictsEqual(PYSMELLDICT, expectedDict)
 
 
+    @ProducesFile('TestData/PYSMELLTAGS')
     def testPackageA(self):
-        if os.path.exists('TestData/PYSMELLTAGS'):
-            os.remove('TestData/PYSMELLTAGS')
         subprocess.call([&quot;pysmell&quot;, &quot;PackageA&quot;], cwd='TestData')
         self.assertTrue(os.path.exists('TestData/PYSMELLTAGS'))
         PYSMELLDICT = eval(open('TestData/PYSMELLTAGS').read())
@@ -115,9 +129,8 @@ class FunctionalTest(unittest.TestCase):
         self.assertDictsEqual(foundDict, expectedDict)
 
 
+    @ProducesFile('TestData/PYSMELLTAGS')
     def testPackageB(self):
-        if os.path.exists('TestData/PYSMELLTAGS'):
-            os.remove('TestData/PYSMELLTAGS')
         subprocess.call([&quot;pysmell&quot;, &quot;PackageB&quot;], cwd='TestData')
         self.assertTrue(os.path.exists('TestData/PYSMELLTAGS'))
         PYSMELLDICT = eval(open('TestData/PYSMELLTAGS').read())
@@ -125,9 +138,8 @@ class FunctionalTest(unittest.TestCase):
         self.assertDictsEqual(PYSMELLDICT, expectedDict)
 
 
+    @ProducesFile('TestData/PackageA/PYSMELLTAGS')
     def testPackageDot(self):
-        if os.path.exists('TestData/PackageA/PYSMELLTAGS'):
-            os.remove('TestData/PackageA/PYSMELLTAGS')
         subprocess.call([&quot;pysmell&quot;, &quot;.&quot;], cwd='TestData/PackageA')
         self.assertTrue(os.path.exists('TestData/PackageA/PYSMELLTAGS'))
         PYSMELLDICT = eval(open('TestData/PackageA/PYSMELLTAGS').read())
@@ -135,9 +147,8 @@ class FunctionalTest(unittest.TestCase):
         self.assertDictsEqual(PYSMELLDICT, expectedDict)
 
 
+    @ProducesFile('TestData/PYSMELLTAGS')
     def testAllPackages(self):
-        if os.path.exists('TestData/PYSMELLTAGS'):
-            os.remove('TestData/PYSMELLTAGS')
         subprocess.call([&quot;pysmell&quot;, &quot;.&quot;], cwd='TestData')
         self.assertTrue(os.path.exists('TestData/PYSMELLTAGS'))
         PYSMELLDICT = eval(open('TestData/PYSMELLTAGS').read())
@@ -152,11 +163,10 @@ class FunctionalTest(unittest.TestCase):
         self.assertDictsEqual(PYSMELLDICT, expectedDict)
 
     
+    @ProducesFile('TestData/PackageA/NestedPackage/EvenMore/PYSMELLTAGS')
     def testSingleFile(self):
         &quot;should recurse up until it doesn't find __init__.py&quot;
         path = 'TestData/PackageA/NestedPackage/EvenMore/'
-        if os.path.exists('%sPYSMELLTAGS' % path):
-            os.remove('%sPYSMELLTAGS' % path)
         subprocess.call([&quot;pysmell&quot;, &quot;ModuleC.py&quot;], cwd=path)
         self.assertTrue(os.path.exists('%sPYSMELLTAGS' % path ))
         PYSMELLDICT = eval(open('%sPYSMELLTAGS' % path).read())
@@ -171,11 +181,10 @@ class FunctionalTest(unittest.TestCase):
         self.assertDictsEqual(PYSMELLDICT, expectedDict)
 
 
+    @ProducesFile(&quot;TestData/PYSMELLTAGS&quot;)
     def testSingleFilesWithPaths(self):
         path = 'TestData'
         pysmell = os.path.join(path, 'PYSMELLTAGS')
-        if os.path.exists(pysmell):
-            os.remove(pysmell)
         subprocess.call([&quot;pysmell&quot;, os.path.join(&quot;PackageA&quot;, &quot;NestedPackage&quot;, &quot;EvenMore&quot;, &quot;ModuleC.py&quot;)], cwd=path)
         self.assertTrue(os.path.exists(pysmell))
         PYSMELLDICT = eval(open(pysmell).read())
@@ -188,12 +197,10 @@ class FunctionalTest(unittest.TestCase):
                         
         }
         self.assertDictsEqual(PYSMELLDICT, expectedDict)
-        
 
 
+    @ProducesFile('TestData/OUTPUTREDIR', 'TestData/OUTPUTREDIR2')
     def testOutputRedirect(self):
-        if os.path.exists('TestData/OUTPUTREDIR'):
-            os.remove('TestData/OUTPUTREDIR')
         subprocess.call([&quot;pysmell&quot;, &quot;PackageA&quot;, &quot;-o&quot;,
             &quot;OUTPUTREDIR&quot;], cwd='TestData')
         self.assertTrue(os.path.exists('TestData/OUTPUTREDIR'))
@@ -202,8 +209,6 @@ class FunctionalTest(unittest.TestCase):
         self.assertDictsEqual(PYSMELLDICT, expectedDict)
 
         absPath = os.path.join(os.getcwd(), 'TestData', 'OUTPUTREDIR2')
-        if os.path.exists(absPath):
-            os.remove(absPath)
         subprocess.call([&quot;pysmell&quot;, &quot;PackageA&quot;, &quot;-o&quot;, absPath], cwd='TestData')
         self.assertTrue(os.path.exists(absPath))
         PYSMELLDICT = eval(open(absPath).read())</diff>
      <filename>Tests/functional_test.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ea8154bd6396adb81384dc3eb6f300eabe333b1f</id>
    </parent>
  </parents>
  <author>
    <name>Orestis Markou</name>
    <email>orestis@orestis.gr</email>
  </author>
  <url>http://github.com/orestis/pysmell/commit/f845ba6c0064d8220b2d59607f4e61dc173d9990</url>
  <id>f845ba6c0064d8220b2d59607f4e61dc173d9990</id>
  <committed-date>2008-11-01T09:25:42-07:00</committed-date>
  <authored-date>2008-11-01T09:25:42-07:00</authored-date>
  <message>remove cruft from test runs</message>
  <tree>3e132b6cd32f13d64b6be98bb213f98c1a768ff1</tree>
  <committer>
    <name>Orestis Markou</name>
    <email>orestis@orestis.gr</email>
  </committer>
</commit>
