Skip to content

Commit b094f30

Browse files
committed
Remove temporary files from cache test.
1 parent 552a1ca commit b094f30

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ test.csv
1414
summary.csv
1515
basic_tournament.csv
1616
test_outputs/*csv
17+
test_outputs/*cache

axelrod/tests/unit/test_deterministic_cache.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from axelrod import DeterministicCache, TitForTat, Defector, Random
55

66
import pickle
7-
import tempfile
87

98

109
class TestDeterministicCache(unittest.TestCase):
@@ -96,10 +95,10 @@ def test_load(self):
9695
self.assertEqual(cache[self.test_key], self.test_value)
9796

9897
def test_load_error_for_inccorect_format(self):
99-
tmp_file = tempfile.NamedTemporaryFile()
100-
with open(tmp_file.name, 'wb') as io:
98+
filename = "test_outputs/test.cache"
99+
with open(filename, 'wb') as io:
101100
pickle.dump(range(5), io)
102101

103102
with self.assertRaises(ValueError):
104103
cache = DeterministicCache()
105-
cache.load(tmp_file.name)
104+
cache.load(filename)

0 commit comments

Comments
 (0)