diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-17 11:46:47 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-06-03 16:57:23 +0100 |
commit | 32c5f9b39ceba9fae5e380f5c2bc5102f81543ca (patch) | |
tree | 28b9c7ee73d3b74af727497d6f64fb05c9f7d1a0 | |
parent | 32f72dbeef34612a729b06c9ce9e94072479b6fb (diff) | |
download | bitbake-32c5f9b39ceba9fae5e380f5c2bc5102f81543ca.tar.gz |
test/fetch: Split the network tests from the rest of the fetcher tests
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/bb/tests/fetch.py | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py index 8bf095cee..a56d7daa3 100644 --- a/lib/bb/tests/fetch.py +++ b/lib/bb/tests/fetch.py @@ -252,7 +252,7 @@ class URITest(unittest.TestCase): self.assertEqual(str(uri), (str(uri).split(";"))[0]) -class FetcherTest(unittest.TestCase): +class FetcherUriTest(unittest.TestCase): replaceuris = { ("git://git.invalid.infradead.org/mtd-utils.git;tag=1234567890123456789012345678901234567890", "git://.*/.*", "http://somewhere.org/somedir/") @@ -294,6 +294,29 @@ class FetcherTest(unittest.TestCase): "https://.*/.* file:///someotherpath/downloads/ \n" \ "http://.*/.* file:///someotherpath/downloads/ \n" + def test_urireplace(self): + for k, v in self.replaceuris.items(): + ud = bb.fetch.FetchData(k[0], self.d) + ud.setup_localpath(self.d) + mirrors = bb.fetch2.mirror_from_string("%s %s" % (k[1], k[2])) + newuris, uds = bb.fetch2.build_mirroruris(ud, mirrors, self.d) + self.assertEqual([v], newuris) + + def test_urilist1(self): + fetcher = bb.fetch.FetchData("http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) + mirrors = bb.fetch2.mirror_from_string(self.mirrorvar) + uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) + self.assertEqual(uris, ['file:///somepath/downloads/bitbake-1.0.tar.gz', 'file:///someotherpath/downloads/bitbake-1.0.tar.gz']) + + def test_urilist2(self): + # Catch https:// -> files:// bug + fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) + mirrors = bb.fetch2.mirror_from_string(self.mirrorvar) + uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) + self.assertEqual(uris, ['file:///someotherpath/downloads/bitbake-1.0.tar.gz']) + +class FetcherTest(unittest.TestCase): + def setUp(self): self.d = bb.data.init() self.tempdir = tempfile.mkdtemp() @@ -389,28 +412,6 @@ class FetcherTest(unittest.TestCase): self.d.setVar("PREMIRRORS", "%s git://%s;protocol=file \n" % (dummyurl, self.sourcedir)) self.gitfetcher(dummyurl, dummyurl) - def test_urireplace(self): - for k, v in self.replaceuris.items(): - ud = bb.fetch.FetchData(k[0], self.d) - ud.setup_localpath(self.d) - mirrors = bb.fetch2.mirror_from_string("%s %s" % (k[1], k[2])) - newuris, uds = bb.fetch2.build_mirroruris(ud, mirrors, self.d) - self.assertEqual([v], newuris) - - def test_urilist1(self): - fetcher = bb.fetch.FetchData("http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) - mirrors = bb.fetch2.mirror_from_string(self.mirrorvar) - uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) - self.assertEqual(uris, ['file:///somepath/downloads/bitbake-1.0.tar.gz', 'file:///someotherpath/downloads/bitbake-1.0.tar.gz']) - - def test_urilist2(self): - # Catch https:// -> files:// bug - fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) - mirrors = bb.fetch2.mirror_from_string(self.mirrorvar) - uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) - self.assertEqual(uris, ['file:///someotherpath/downloads/bitbake-1.0.tar.gz']) - - class URLHandle(unittest.TestCase): datatable = { |