chiark / gitweb /
tests: name temp test dir after test function that used it
authorHans-Christoph Steiner <hans@eds.org>
Thu, 30 Nov 2017 08:59:02 +0000 (09:59 +0100)
committerHans-Christoph Steiner <hans@eds.org>
Thu, 30 Nov 2017 16:32:53 +0000 (17:32 +0100)
tests/common.TestCase
tests/lint.TestCase
tests/update.TestCase

index 84ea77fac05bf1970d63b5fea93b8a3099cf42d3..87e9da747b880e16c474f76df1ff25917e8d18f9 100755 (executable)
@@ -96,8 +96,8 @@ class CommonTest(unittest.TestCase):
                 print('no build-tools found: ' + build_tools)
 
     def test_find_java_root_path(self):
-        tmptestsdir = tempfile.mkdtemp(prefix='test_find_java_root_path', dir=self.tmpdir)
-        os.chdir(tmptestsdir)
+        testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir)
+        os.chdir(testdir)
 
         all_pathlists = [
             ([  # Debian
@@ -215,7 +215,7 @@ class CommonTest(unittest.TestCase):
 
     def test_prepare_sources_refresh(self):
         packageName = 'org.fdroid.ci.test.app'
-        testdir = tempfile.mkdtemp(prefix='test_prepare_sources_refresh', dir=self.tmpdir)
+        testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir)
         print('testdir', testdir)
         os.chdir(testdir)
         os.mkdir('build')
@@ -262,7 +262,7 @@ class CommonTest(unittest.TestCase):
         fdroidserver.signindex.config = config
 
         sourcedir = os.path.join(self.basedir, 'signindex')
-        testsdir = tempfile.mkdtemp(prefix='test_signjar', dir=self.tmpdir)
+        testsdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir)
         for f in ('testy.jar', 'guardianproject.jar',):
             sourcefile = os.path.join(sourcedir, f)
             testfile = os.path.join(testsdir, f)
@@ -291,7 +291,7 @@ class CommonTest(unittest.TestCase):
 
         sourceapk = os.path.join(self.basedir, 'urzip.apk')
 
-        testdir = tempfile.mkdtemp(prefix='test_verify_apks', dir=self.tmpdir)
+        testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir)
         print('testdir', testdir)
 
         copyapk = os.path.join(testdir, 'urzip-copy.apk')
index f2a411c5f61917c1016a2b6cb5833f98c7a142aa..433c07875d8f39755f6af072bc7c113d3b2455e6 100755 (executable)
@@ -32,8 +32,7 @@ class LintTest(unittest.TestCase):
         self.assertTrue(fdroidserver.lint.check_for_unsupported_metadata_files())
 
         tmpdir = os.path.join(localmodule, '.testfiles')
-        tmptestsdir = tempfile.mkdtemp(prefix='test_check_for_unsupported_metadata_files-',
-                                       dir=tmpdir)
+        tmptestsdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=tmpdir)
         self.assertFalse(fdroidserver.lint.check_for_unsupported_metadata_files(tmptestsdir + '/'))
         shutil.copytree(os.path.join(localmodule, 'tests', 'metadata'),
                         os.path.join(tmptestsdir, 'metadata'),
index 8a88fc4e936a9742769e231963a8f3301a446422..966e00e9d8b92c4411dad8e7925ba8479bc35a83 100755 (executable)
@@ -87,7 +87,7 @@ class UpdateTest(unittest.TestCase):
         tmpdir = os.path.join(localmodule, '.testfiles')
         if not os.path.exists(tmpdir):
             os.makedirs(tmpdir)
-        tmptestsdir = tempfile.mkdtemp(prefix='test_insert_triple_t_metadata-', dir=tmpdir)
+        tmptestsdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=tmpdir)
         packageDir = os.path.join(tmptestsdir, 'build', packageName)
         shutil.copytree(importer, packageDir)
 
@@ -374,7 +374,7 @@ class UpdateTest(unittest.TestCase):
         tmpdir = os.path.join(localmodule, '.testfiles')
         if not os.path.exists(tmpdir):
             os.makedirs(tmpdir)
-        tmptestsdir = tempfile.mkdtemp(prefix='test_process_apk_signed_by_disabled_algorithms-',
+        tmptestsdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name,
                                        dir=tmpdir)
         print('tmptestsdir', tmptestsdir)
         os.chdir(tmptestsdir)
@@ -504,7 +504,7 @@ class UpdateTest(unittest.TestCase):
         tmpdir = os.path.join(localmodule, '.testfiles')
         if not os.path.exists(tmpdir):
             os.makedirs(tmpdir)
-        tmptestsdir = tempfile.mkdtemp(prefix='test_create_metadata_from_template-',
+        tmptestsdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name,
                                        dir=tmpdir)
         print('tmptestsdir', tmptestsdir)
         os.chdir(tmptestsdir)