Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py	(revision 9271)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py	(revision 9272)
@@ -95,5 +95,6 @@
 
 STUDENT_SAMPLE_DATA_MIGRATION = open(
-    os.path.join(os.path.dirname(__file__), 'sample_student_data_migration.csv'),
+    os.path.join(os.path.dirname(__file__),
+                 'sample_student_data_migration.csv'),
     'rb').read()
 
@@ -102,5 +103,6 @@
 
 STUDENT_SAMPLE_DATA_DUPLICATES = open(
-    os.path.join(os.path.dirname(__file__), 'sample_student_data_duplicates.csv'),
+    os.path.join(os.path.dirname(__file__),
+                 'sample_student_data_duplicates.csv'),
     'rb').read()
 
@@ -256,5 +258,4 @@
 
         self.processor = StudentProcessor()
-        self.workdir = tempfile.mkdtemp()
         self.csv_file = os.path.join(self.workdir, 'sample_student_data.csv')
         self.csv_file_update = os.path.join(
@@ -377,5 +378,6 @@
         self.assertEqual(self.app['students']['X666666'].state,'admitted')
         # state has not changed
-        self.assertEqual(self.app['students']['Y777777'].state,'courses validated')
+        self.assertEqual(self.app['students']['Y777777'].state,
+                         'courses validated')
         shutil.rmtree(os.path.dirname(fin_file))
 
@@ -411,4 +413,5 @@
             self.csv_file_update3, STUDENT_HEADER_FIELDS_UPDATE3, 'update')
         content = open(fail_file).read()
+        shutil.rmtree(os.path.dirname(fin_file))
         self.assertEqual(
             content,
@@ -546,13 +549,16 @@
     def test_checkUpdateRequirements(self):
         # Make sure that pg students can't be updated with wrong transition.
-        err = self.processor.checkUpdateRequirements(self.student['studycourse'],
+        err = self.processor.checkUpdateRequirements(
+            self.student['studycourse'],
             dict(reg_number='1', current_level='100'), self.app)
         self.assertTrue(err is None)
         # Since row has passed the converter, current_level is an integer.
-        err = self.processor.checkUpdateRequirements(self.student['studycourse'],
+        err = self.processor.checkUpdateRequirements(
+            self.student['studycourse'],
             dict(reg_number='1', current_level=999), self.app)
         self.assertTrue(err is None)
         IWorkflowState(self.student).setState('returning')
-        err = self.processor.checkUpdateRequirements(self.student['studycourse'],
+        err = self.processor.checkUpdateRequirements(
+            self.student['studycourse'],
             dict(reg_number='1', current_level=999), self.app)
         self.assertEqual(err, 'Not a pg student.')
@@ -600,6 +606,8 @@
             self.csv_file, VERDICT_HEADER_FIELDS,'update')
         self.assertEqual(num_warns,3)
-        studycourse = self.processor.getEntry(dict(matric_number='100000'), self.app)
-        student = self.processor.getParent(dict(matric_number='100000'), self.app)
+        studycourse = self.processor.getEntry(dict(matric_number='100000'),
+                                              self.app)
+        student = self.processor.getParent(
+            dict(matric_number='100000'), self.app)
         self.assertEqual(studycourse.current_verdict, 'A')
         self.assertEqual(student.state, 'returning')
@@ -688,4 +696,5 @@
         num, num_warns, fin_file, fail_file = self.processor.doImport(
             self.csv_file, STUDYLEVEL_HEADER_FIELDS,'create')
+        shutil.rmtree(os.path.dirname(fin_file))
         num, num_warns, fin_file, fail_file = self.processor.doImport(
             self.csv_file, STUDYLEVEL_HEADER_FIELDS,'update')
@@ -713,5 +722,6 @@
         self.app['faculties']['fac1']['dep1'].courses.addCourse(
             self.course)
-        self.app['faculties']['fac1']['dep1'].certificates['CERT1'].addCertCourse(
+        self.app['faculties']['fac1']['dep1'].certificates[
+            'CERT1'].addCertCourse(
             self.course, level=100)
 
@@ -761,8 +771,10 @@
         self.assertEqual(num_warns,2)
         assert self.processor.entryExists(
-            dict(reg_number='1', level='100', code='COURSE1'), self.app) is True
+            dict(reg_number='1', level='100', code='COURSE1'),
+            self.app) is True
         courseticket = self.processor.getEntry(
             dict(reg_number='1', level='100', code='COURSE1'), self.app)
-        self.assertEqual(courseticket.__parent__.__parent__.certificate.code, u'CERT1')
+        self.assertEqual(courseticket.__parent__.__parent__.certificate.code,
+                         u'CERT1')
         self.assertEqual(courseticket.score, 1)
         self.assertEqual(courseticket.mandatory, True)
@@ -789,4 +801,5 @@
         num, num_warns, fin_file, fail_file = self.processor.doImport(
             self.csv_file, COURSETICKET_HEADER_FIELDS,'create')
+        shutil.rmtree(os.path.dirname(fin_file))
         num, num_warns, fin_file, fail_file = self.processor.doImport(
             self.csv_file, COURSETICKET_HEADER_FIELDS,'update')
@@ -800,4 +813,5 @@
         num, num_warns, fin_file, fail_file = self.processor.doImport(
             self.csv_file, COURSETICKET_HEADER_FIELDS,'create')
+        shutil.rmtree(os.path.dirname(fin_file))
         assert self.processor.entryExists(
             dict(reg_number='1', level='100', code='COURSE1'), self.app) is True
@@ -946,4 +960,5 @@
         num, num_warns, fin_file, fail_file = self.processor.doImport(
             self.csv_file, PAYMENT_HEADER_FIELDS,'create')
+        shutil.rmtree(os.path.dirname(fin_file))
         num, num_warns, fin_file, fail_file = self.processor.doImport(
             self.csv_file, PAYMENT_HEADER_FIELDS,'update')
@@ -954,4 +969,5 @@
         num, num_warns, fin_file, fail_file = self.processor.doImport(
             self.csv_file, PAYMENT_HEADER_FIELDS,'create')
+        shutil.rmtree(os.path.dirname(fin_file))
         num, num_warns, fin_file, fail_file = self.processor.doImport(
             self.csv_file, PAYMENT_HEADER_FIELDS,'remove')
