From 725344d349097bcb48ddc24b13d0a24a32d2b348 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 26 Oct 2015 21:08:18 +1100 Subject: [PATCH] * Fix tempfile in test --- spacy/tests/vocab/test_intern.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spacy/tests/vocab/test_intern.py b/spacy/tests/vocab/test_intern.py index 2c2cfd4f1..76d6dc740 100644 --- a/spacy/tests/vocab/test_intern.py +++ b/spacy/tests/vocab/test_intern.py @@ -5,6 +5,7 @@ import pickle from spacy.strings import StringStore import pytest +import tempfile import io @@ -95,10 +96,9 @@ def test_pickle_string_store(sstore): def test_dump_load(sstore): id_ = sstore[u'qqqqq'] - loc = '/tmp/sstore.json' - with io.open(loc, 'w', encoding='utf8') as file_: + with tempfile.TemporaryFile() as file_: sstore.dump(file_) - new_store = StringStore() - with io.open(loc, 'r', encoding='utf8') as file_: + file_.seek(0) + new_store = StringStore() new_store.load(file_) assert new_store[id_] == u'qqqqq'