diff options
author | Ross Burton <ross.burton@intel.com> | 2018-12-03 11:47:58 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-12-06 10:18:50 +0000 |
commit | eee30d799ff892443d21de4128e7d643215b0ac1 (patch) | |
tree | 9492e381220e1b689c33d545de4a2a8b2575178f /meta | |
parent | 1ec53b8d82491aeb9f49e7a78f531e98b5608f0f (diff) | |
download | openembedded-core-eee30d799ff892443d21de4128e7d643215b0ac1.tar.gz openembedded-core-eee30d799ff892443d21de4128e7d643215b0ac1.tar.bz2 openembedded-core-eee30d799ff892443d21de4128e7d643215b0ac1.zip |
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')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/oelib/path.py | 10 |
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): ( "b/test", errno.ENOENT ), ] - def __del__(self): - try: - #os.system("tree -F %s" % self.tmpdir) - shutil.rmtree(self.tmpdir) - except: - pass - def setUp(self): self.tmpdir = tempfile.mkdtemp(prefix = "oe-test_path") self.root = os.path.join(self.tmpdir, "R") @@ -59,6 +52,9 @@ class TestRealPath(TestCase): for l in self.LINKS: os.symlink(l[1], os.path.join(self.root, l[0])) + def tearDown(self): + shutil.rmtree(self.tmpdir) + def __realpath(self, file, use_physdir, assume_dir = True): return oe.path.realpath(os.path.join(self.root, file), self.root, use_physdir, assume_dir = assume_dir) |