Skip to content

Commit f9cd3dd

Browse files
committed
add missing file
1 parent 031b60b commit f9cd3dd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

python-pybind/tests/test_tools.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# -*- coding: utf-8 -*-
2+
# some common tools for tests
3+
4+
import contextlib
5+
import os
6+
import tempfile
7+
8+
from keyvi_scikit_core.dictionary import Dictionary
9+
10+
11+
@contextlib.contextmanager
12+
def tmp_dictionary(compiler, file_name):
13+
tmp_dir = tempfile.gettempdir()
14+
fq_file_name = os.path.join(tmp_dir, file_name)
15+
compiler.Compile()
16+
compiler.WriteToFile(fq_file_name)
17+
del compiler
18+
d = Dictionary(fq_file_name)
19+
yield d
20+
del d
21+
os.remove(fq_file_name)

0 commit comments

Comments
 (0)