blob: ae89bfaefcc9ec80170c772063cd821624be43e7 [file] [log] [blame]
Javi Merinoc26e1c72014-04-08 16:39:01 +01001#!/usr/bin/python
2
3import unittest
4import os, sys
5import shutil, tempfile
6
7TESTS_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
8sys.path.append(os.path.join(TESTS_DIRECTORY, "..", "cr2"))
9
10class SetupDirectory(unittest.TestCase):
11 def __init__(self, files_to_copy, *args, **kwargs):
12 self.files_to_copy = files_to_copy
13 super(SetupDirectory, self).__init__(*args, **kwargs)
14
15 def setUp(self):
16 self.out_dir = tempfile.mkdtemp()
17 os.chdir(self.out_dir)
18
19 for fname in self.files_to_copy:
20 src_fname = os.path.join(TESTS_DIRECTORY, fname)
21 shutil.copy(src_fname, self.out_dir)
22
23 def tearDown(self):
24 shutil.rmtree(self.out_dir)