summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/oelib
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-12-03 11:47:58 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-05 12:37:02 +0000
commit367df47d374447c61f75b9aca436eaccf725aa5b (patch)
tree5c26ea3e0893f5360c1abadccd49432eac246b44 /meta/lib/oeqa/selftest/cases/oelib
parentb7ffedc262028bd151201ab0216aac55e4d45fec (diff)
downloadpoky-367df47d374447c61f75b9aca436eaccf725aa5b.tar.gz
oeqa/oelib/path: don't leak temporary directories
setUp() is used to populate a directory of temporary files, and deleted in __del__. However setUp() is called once *per test* so __del__ would only be able to remove the last directory created. Fix the code by using the natural counterpart to setUp, tearDown(), to clean up. (From OE-Core rev: 68b4723e6fb11d171869185bccf28f32f6284c18) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/oelib')
-rw-r--r--meta/lib/oeqa/selftest/cases/oelib/path.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/meta/lib/oeqa/selftest/cases/oelib/path.py b/meta/lib/oeqa/selftest/cases/oelib/path.py
index 75a27c06f7..e0eb8134a9 100644
--- a/meta/lib/oeqa/selftest/cases/oelib/path.py
+++ b/meta/lib/oeqa/selftest/cases/oelib/path.py
@@ -38,13 +38,6 @@ class TestRealPath(TestCase):
38 ( "b/test", errno.ENOENT ), 38 ( "b/test", errno.ENOENT ),
39 ] 39 ]
40 40
41 def __del__(self):
42 try:
43 #os.system("tree -F %s" % self.tmpdir)
44 shutil.rmtree(self.tmpdir)
45 except:
46 pass
47
48 def setUp(self): 41 def setUp(self):
49 self.tmpdir = tempfile.mkdtemp(prefix = "oe-test_path") 42 self.tmpdir = tempfile.mkdtemp(prefix = "oe-test_path")
50 self.root = os.path.join(self.tmpdir, "R") 43 self.root = os.path.join(self.tmpdir, "R")
@@ -59,6 +52,9 @@ class TestRealPath(TestCase):
59 for l in self.LINKS: 52 for l in self.LINKS:
60 os.symlink(l[1], os.path.join(self.root, l[0])) 53 os.symlink(l[1], os.path.join(self.root, l[0]))
61 54
55 def tearDown(self):
56 shutil.rmtree(self.tmpdir)
57
62 def __realpath(self, file, use_physdir, assume_dir = True): 58 def __realpath(self, file, use_physdir, assume_dir = True):
63 return oe.path.realpath(os.path.join(self.root, file), self.root, 59 return oe.path.realpath(os.path.join(self.root, file), self.root,
64 use_physdir, assume_dir = assume_dir) 60 use_physdir, assume_dir = assume_dir)