Skip to content
This repository
Browse code

Use system temp for test_SeqIO_index.py index files

  • Loading branch information...
commit 67a3ef3faa2f6eaa07d3d0e0cb2a14f2d7b088e8 1 parent 0b80de4
Peter Cock authored April 04, 2013

Showing 1 changed file with 10 additions and 1 deletion. Show diff stats Hide diff stats

  1. 11  Tests/test_SeqIO_index.py
11  Tests/test_SeqIO_index.py
@@ -15,6 +15,7 @@
15 15
 import sys
16 16
 import os
17 17
 import unittest
  18
+import tempfile
18 19
 import gzip
19 20
 from StringIO import StringIO
20 21
 try:
@@ -94,6 +95,14 @@ def test_old_files_wrong2(self):
94 95
 
95 96
 class IndexDictTests(unittest.TestCase):
96 97
     """Cunning unit test where methods are added at run time."""
  98
+    def setUp(self):
  99
+        self.index_tmp = tempfile.gettempprefix() + ".idx.tmp"
  100
+        self.assertFalse(os.path.isfile(self.index_tmp), self.index_tmp)
  101
+
  102
+    def tearDown(self):
  103
+        if os.path.isfile(self.index_tmp):
  104
+            os.remove(self.index_tmp)
  105
+
97 106
     def simple_check(self, filename, format, alphabet, comp):
98 107
         """Check indexing (without a key function)."""
99 108
         if comp:
@@ -126,7 +135,7 @@ def simple_check(self, filename, format, alphabet, comp):
126 135
                           ":memory:", filenames=["dummy"])
127 136
 
128 137
         #Saving to file...
129  
-        index_tmp = filename + ".idx"
  138
+        index_tmp = self.index_tmp
130 139
         if os.path.isfile(index_tmp):
131 140
             os.remove(index_tmp)
132 141
 

0 notes on commit 67a3ef3

Please sign in to comment.
Something went wrong with that request. Please try again.