tests: learn to rename files that are copied for all tests
Make files_to_copy an array of tuples in which the first element is
the source filename and the second the destination name. That we can
rename files, useful since CR2 assumes that the trace is called trace.txt.
diff --git a/tests/test_base.py b/tests/test_base.py
index 62fa9d0..6de4e39 100644
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -63,7 +63,8 @@
def __init__(self, *args, **kwargs):
super(TestBase, self).__init__(
- ["trace.txt", "trace_empty.txt"],
+ [("trace.txt", "trace.txt"),
+ ("trace_empty.txt", "trace_empty.txt")],
*args,
**kwargs)
diff --git a/tests/test_results.py b/tests/test_results.py
index c2b9f31..6228ab3 100644
--- a/tests/test_results.py
+++ b/tests/test_results.py
@@ -13,7 +13,8 @@
class TestResults(utils_tests.SetupDirectory):
def __init__(self, *args, **kwargs):
super(TestResults, self).__init__(
- ["results.csv", "new_antutu_results.csv"],
+ [("results.csv", "results.csv"),
+ ("new_antutu_results.csv", "new_antutu_results.csv")],
*args, **kwargs)
def test_get_results(self):
diff --git a/tests/test_thermal.py b/tests/test_thermal.py
index ab7f99b..3955614 100644
--- a/tests/test_thermal.py
+++ b/tests/test_thermal.py
@@ -16,7 +16,8 @@
class BaseTestThermal(utils_tests.SetupDirectory):
def __init__(self, *args, **kwargs):
super(BaseTestThermal, self).__init__(
- ["trace.txt", "trace_empty.txt"],
+ [("trace.txt", "trace.txt"),
+ ("trace_empty.txt", "trace_empty.txt")],
*args,
**kwargs)
diff --git a/tests/utils_tests.py b/tests/utils_tests.py
index d63165e..c0aa33f 100644
--- a/tests/utils_tests.py
+++ b/tests/utils_tests.py
@@ -17,9 +17,9 @@
self.out_dir = tempfile.mkdtemp()
os.chdir(self.out_dir)
- for fname in self.files_to_copy:
- src_fname = os.path.join(TESTS_DIRECTORY, fname)
- shutil.copy(src_fname, self.out_dir)
+ for src_fname, dst_fname in self.files_to_copy:
+ src_fname = os.path.join(TESTS_DIRECTORY, src_fname)
+ shutil.copy(src_fname, os.path.join(self.out_dir, dst_fname))
def tearDown(self):
os.chdir(self.previous_dir)