Skip to content

Commit

Permalink
Python: Use a temporary directory for generated files in tests (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksay authored and eustas committed Dec 12, 2016
1 parent 4651f7c commit 6f22722
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/tests/_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import sys
import sysconfig
import tempfile
import unittest


Expand Down Expand Up @@ -44,13 +45,15 @@
TESTDATA_PATHS_FOR_DECOMPRESSION = glob.glob(
os.path.join(TESTDATA_DIR, '*.compressed'))

TEMP_DIR = tempfile.mkdtemp()


def get_temp_compressed_name(filename):
return filename + '.bro'
return os.path.join(TEMP_DIR, os.path.basename(filename + '.bro'))


def get_temp_uncompressed_name(filename):
return filename + '.unbro'
return os.path.join(TEMP_DIR, os.path.basename(filename + '.unbro'))


def bind_method_args(method, *args, **kwargs):
Expand Down

0 comments on commit 6f22722

Please sign in to comment.