* [PATCH] bb.tests.fetch: Opt-in for unittests that require network
@ 2013-03-25 19:32 Olof Johansson
2013-03-25 21:09 ` Richard Purdie
0 siblings, 1 reply; 3+ messages in thread
From: Olof Johansson @ 2013-03-25 19:32 UTC (permalink / raw)
To: bitbake-devel
With this change, you have to opt-in to run unit tests that require an internet
connection. To opt-in, you'll set the environment variable BB_NETTESTS to 'yes'.
Signed-off-by: Olof Johansson <olof.johansson@axis.com>
---
lib/bb/tests/fetch.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index 778d94f..d51aace 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -308,6 +308,8 @@ class FetcherTest(unittest.TestCase):
def tearDown(self):
bb.utils.prunedir(self.tempdir)
+ @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
+ "Set BB_NETTESTS to yes to run network tests")
def test_fetch(self):
fetcher = bb.fetch.Fetch(["http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", "http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.1.tar.gz"], self.d)
fetcher.download()
@@ -320,12 +322,16 @@ class FetcherTest(unittest.TestCase):
self.assertEqual(len(os.listdir(self.unpackdir + "/bitbake-1.0/")), 9)
self.assertEqual(len(os.listdir(self.unpackdir + "/bitbake-1.1/")), 9)
+ @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
+ "Set BB_NETTESTS to yes to run network tests")
def test_fetch_mirror(self):
self.d.setVar("MIRRORS", "http://.*/.* http://downloads.yoctoproject.org/releases/bitbake")
fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
fetcher.download()
self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
+ @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
+ "Set BB_NETTESTS to yes to run network tests")
def test_fetch_premirror(self):
self.d.setVar("PREMIRRORS", "http://.*/.* http://downloads.yoctoproject.org/releases/bitbake")
fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
@@ -351,21 +357,29 @@ class FetcherTest(unittest.TestCase):
fetcher.download()
checkrevision(self, fetcher)
+ @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
+ "Set BB_NETTESTS to yes to run network tests")
def test_gitfetch(self):
url1 = url2 = "git://git.openembedded.org/bitbake"
self.gitfetcher(url1, url2)
+ @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
+ "Set BB_NETTESTS to yes to run network tests")
def test_gitfetch_premirror(self):
url1 = "git://git.openembedded.org/bitbake"
url2 = "git://someserver.org/bitbake"
self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n")
self.gitfetcher(url1, url2)
+ @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
+ "Set BB_NETTESTS to yes to run network tests")
def test_gitfetch_premirror2(self):
url1 = url2 = "git://someserver.org/bitbake"
self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n")
self.gitfetcher(url1, url2)
+ @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
+ "Set BB_NETTESTS to yes to run network tests")
def test_gitfetch_premirror3(self):
realurl = "git://git.openembedded.org/bitbake"
dummyurl = "git://someserver.org/bitbake"
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bb.tests.fetch: Opt-in for unittests that require network
2013-03-25 19:32 [PATCH] bb.tests.fetch: Opt-in for unittests that require network Olof Johansson
@ 2013-03-25 21:09 ` Richard Purdie
2013-03-26 8:12 ` Olof Johansson
0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2013-03-25 21:09 UTC (permalink / raw)
To: Olof Johansson; +Cc: bitbake-devel
On Mon, 2013-03-25 at 20:32 +0100, Olof Johansson wrote:
> With this change, you have to opt-in to run unit tests that require an internet
> connection. To opt-in, you'll set the environment variable BB_NETTESTS to 'yes'.
Can we do this the other way please and let people opt-out? I'd rather
people make a conscious decision to opt-out than in.
Cheers,
Richard
> Signed-off-by: Olof Johansson <olof.johansson@axis.com>
> ---
> lib/bb/tests/fetch.py | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
> index 778d94f..d51aace 100644
> --- a/lib/bb/tests/fetch.py
> +++ b/lib/bb/tests/fetch.py
> @@ -308,6 +308,8 @@ class FetcherTest(unittest.TestCase):
> def tearDown(self):
> bb.utils.prunedir(self.tempdir)
>
> + @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
> + "Set BB_NETTESTS to yes to run network tests")
> def test_fetch(self):
> fetcher = bb.fetch.Fetch(["http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", "http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.1.tar.gz"], self.d)
> fetcher.download()
> @@ -320,12 +322,16 @@ class FetcherTest(unittest.TestCase):
> self.assertEqual(len(os.listdir(self.unpackdir + "/bitbake-1.0/")), 9)
> self.assertEqual(len(os.listdir(self.unpackdir + "/bitbake-1.1/")), 9)
>
> + @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
> + "Set BB_NETTESTS to yes to run network tests")
> def test_fetch_mirror(self):
> self.d.setVar("MIRRORS", "http://.*/.* http://downloads.yoctoproject.org/releases/bitbake")
> fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
> fetcher.download()
> self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
>
> + @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
> + "Set BB_NETTESTS to yes to run network tests")
> def test_fetch_premirror(self):
> self.d.setVar("PREMIRRORS", "http://.*/.* http://downloads.yoctoproject.org/releases/bitbake")
> fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
> @@ -351,21 +357,29 @@ class FetcherTest(unittest.TestCase):
> fetcher.download()
> checkrevision(self, fetcher)
>
> + @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
> + "Set BB_NETTESTS to yes to run network tests")
> def test_gitfetch(self):
> url1 = url2 = "git://git.openembedded.org/bitbake"
> self.gitfetcher(url1, url2)
>
> + @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
> + "Set BB_NETTESTS to yes to run network tests")
> def test_gitfetch_premirror(self):
> url1 = "git://git.openembedded.org/bitbake"
> url2 = "git://someserver.org/bitbake"
> self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n")
> self.gitfetcher(url1, url2)
>
> + @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
> + "Set BB_NETTESTS to yes to run network tests")
> def test_gitfetch_premirror2(self):
> url1 = url2 = "git://someserver.org/bitbake"
> self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n")
> self.gitfetcher(url1, url2)
>
> + @unittest.skipUnless(os.environ.get("BB_NETTESTS") == "yes",
> + "Set BB_NETTESTS to yes to run network tests")
> def test_gitfetch_premirror3(self):
> realurl = "git://git.openembedded.org/bitbake"
> dummyurl = "git://someserver.org/bitbake"
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bb.tests.fetch: Opt-in for unittests that require network
2013-03-25 21:09 ` Richard Purdie
@ 2013-03-26 8:12 ` Olof Johansson
0 siblings, 0 replies; 3+ messages in thread
From: Olof Johansson @ 2013-03-26 8:12 UTC (permalink / raw)
To: Richard Purdie; +Cc: bitbake-devel@lists.openembedded.org
On 2013-03-25 22:09, Richard Purdie wrote:
> On Mon, 2013-03-25 at 20:32 +0100, Olof Johansson wrote:
> > With this change, you have to opt-in to run unit tests that require an internet
> > connection. To opt-in, you'll set the environment variable BB_NETTESTS to 'yes'.
>
> Can we do this the other way please and let people opt-out? I'd rather
> people make a conscious decision to opt-out than in.
Sure! I'm just used to unit tests not having (or having very
limited) side effects by default. But it's easy to change, so
I'll do it right away. Thanks for the feedback.
/Olof Johansson
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-26 8:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-25 19:32 [PATCH] bb.tests.fetch: Opt-in for unittests that require network Olof Johansson
2013-03-25 21:09 ` Richard Purdie
2013-03-26 8:12 ` Olof Johansson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.