Skip to content
Snippets Groups Projects
Commit 58843268916b authored by Boris Feld's avatar Boris Feld
Browse files

Use a tempdir instead and clean it in the teardown method

parent 984badc7eb52
No related branches found
No related tags found
No related merge requests found
......@@ -10,9 +10,10 @@
import subprocess
import stat
import sys
import tempfile
if sys.version_info[0] == 2:
import Queue as queue
else:
import queue
......@@ -13,10 +14,9 @@
if sys.version_info[0] == 2:
import Queue as queue
else:
import queue
from .utils import (BaseNChangesetsTestSuite, BaseTimeTestSuite,
BaseTrackTestSuite, median, REPOS_DIR)
......@@ -113,6 +113,14 @@
param_names = TimeTestSuite.param_names
params = TimeTestSuite.params + [['files', 'tar']]
def setup(self, *args, **kwargs):
super(ArchiveTimeTestSuite, self).setup(*args, **kwargs)
self.output_dir = tempfile.mkdtemp()
self.output = os.path.join(self.output_dir, 'archive')
def teardown(self, *args, **kwargs):
shutil.rmtree(self.output_dir)
def time_archive(self, repo, archive_type, *args, **kwargs):
# asv share the same temporary directory for all combinations
# so use an unique output name
......@@ -116,9 +124,7 @@
def time_archive(self, repo, archive_type, *args, **kwargs):
# asv share the same temporary directory for all combinations
# so use an unique output name
output = os.path.join(os.getcwd(), '{}_archive_{}_{}'.format(
repo, archive_type, time.time()))
return self._execute('archive', '-t', archive_type, '-r', 'default', output)
return self._execute('archive', '-t', archive_type, '-r', 'default', self.output)
class LogTimeTestSuite(BaseNChangesetsTestSuite):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment