Forráskód Böngészése

Clean all the files created by tests

oz123 10 éve
szülő
commit
0a2245d78f
4 módosított fájl, 11 hozzáadás és 2 törlés
  1. 0 2
      Makefile
  2. 2 0
      pwman/tests/test_base_ui.py
  3. 4 0
      pwman/tests/test_factory.py
  4. 5 0
      pwman/tests/test_tools.py

+ 0 - 2
Makefile

@@ -17,8 +17,6 @@ clean_all:
 	clean_coverage_report
 
 clean: clean-build clean-pyc
-	rm -f test.db
-	rm -f pwman/tests/test.conf 
 
 clean_docs:
 	$(MAKE) -C docs clean

+ 2 - 0
pwman/tests/test_base_ui.py

@@ -56,6 +56,8 @@ class TestBaseUI(unittest.TestCase):
             except OSError:
                 continue
 
+        SetupTester().clean()
+
     def setUp(self):
         "test that the right db instance was created"
         dbver = __DB_FORMAT__

+ 4 - 0
pwman/tests/test_factory.py

@@ -66,6 +66,10 @@ testdb = os.path.join(os.path.dirname(__file__), "test.pwman.db")
 
 class TestFactory(unittest.TestCase):
 
+    @classmethod
+    def tearDownClass(cls):
+        SetupTester().clean()
+
     def setUp(self):
         "test that the right db instance was created"
         self.dbtype = 'SQLite'

+ 5 - 0
pwman/tests/test_tools.py

@@ -96,6 +96,11 @@ class SetupTester(object):
             os.remove(os.path.join(os.path.dirname(__file__),
                                    'testing_config'))
 
+        if os.path.exists(os.path.join(os.path.dirname(__file__),
+                                       'test.conf')):
+            os.remove(os.path.join(os.path.dirname(__file__),
+                                   'test.conf'))
+
     def create(self):
         dbtype = 'SQLite'
         db = factory.create(dbtype, self.dbver, self.filename)