bitbake: 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.)

(Bitbake rev: b1653855c74f86909c9f329ed6d2b10391c28395)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton 2015-05-14 14:33:50 +01:00 committed by Richard Purdie
parent f5a87b4707
commit c5316d4d57
1 changed files with 2 additions and 0 deletions

View File

@ -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):