[oe-commits] [bitbake] 02/02: tests/fetch: ensure fetch tests preserve current dir

git at git.openembedded.org git at git.openembedded.org
Mon May 9 10:11:30 UTC 2016


rpurdie pushed a commit to branch 1.26
in repository bitbake.

commit fdb6c123593fd2255b9b09e6bdf7306d64a82892
Author: Paul Eggleton <paul.eggleton at linux.intel.com>
AuthorDate: Thu May 14 14:33:50 2015 +0100

    tests/fetch: ensure fetch tests preserve current dir
    
    The fetcher calls os.chdir() in a number of places, which can affect
    other tests (since the directory it changes into gets deleted) - let's
    just put the current directory back to where it was when we're done.
    
    (This fixes bb.tests.Path.test_unsafe_delete_path failing if it was run
    as part of a full bitbake-selftest run, where the fetcher tests get to
    run before it.)
    
    Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/tests/fetch.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index 2629361..dc3429d 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -315,6 +315,7 @@ class URITest(unittest.TestCase):
 class FetcherTest(unittest.TestCase):
 
     def setUp(self):
+        self.origdir = os.getcwd()
         self.d = bb.data.init()
         self.tempdir = tempfile.mkdtemp()
         self.dldir = os.path.join(self.tempdir, "download")
@@ -326,6 +327,7 @@ class FetcherTest(unittest.TestCase):
         self.d.setVar("PERSISTENT_DIR", persistdir)
 
     def tearDown(self):
+        os.chdir(self.origdir)
         bb.utils.prunedir(self.tempdir)
 
 class MirrorUriTest(FetcherTest):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list