All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: [PATCH] tests/fetch: Add versionstring tests to network tests list, fix print()
Date: Tue, 23 Dec 2014 12:33:10 +0000	[thread overview]
Message-ID: <1419337990.6428.3.camel@linuxfoundation.org> (raw)

The versionstring tests hit the network so should only run when
network tests are enabled.

Also remove the print statement which confuses the test output and
add it to the test failure message instead.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 3f80c4a..6eb0f2d 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -624,23 +624,23 @@ class FetchMethodTest(FetcherTest):
         ("db", "http://download.oracle.com/berkeley-db/db-5.3.21.tar.gz", "http://www.oracle.com/technetwork/products/berkeleydb/downloads/index-082944.html", "http://download.oracle.com/otn/berkeley-db/(?P<name>db-)(?P<pver>((\d+[\.\-_]*)+))\.tar\.gz")
             : "6.1.19",
     }
-
-    def test_git_latest_versionstring(self):
-        for k, v in self.test_git_uris.items():
-            self.d.setVar("SRCREV", k[2])
-            self.d.setVar("GITTAGREGEX", k[3])
-            ud = bb.fetch2.FetchData(k[1], self.d)
-            verstring = ud.method.latest_versionstring(ud, self.d)
-            print("Package %s, version: %s <= %s" % (k[0], v, verstring))
-            r = bb.utils.vercmp_string(v, verstring)
-            self.assertTrue(r == -1 or r == 0)
-
-    def test_wget_latest_versionstring(self):
-        for k, v in self.test_wget_uris.items():
-            self.d.setVar("REGEX_URI", k[2])
-            self.d.setVar("REGEX", k[3])
-            ud = bb.fetch2.FetchData(k[1], self.d)
-            verstring = ud.method.latest_versionstring(ud, self.d)
-            print("Package %s, version: %s <= %s" % (k[0], v, verstring))
-            r = bb.utils.vercmp_string(v, verstring)
-            self.assertTrue(r == -1 or r == 0)
+    if os.environ.get("BB_SKIP_NETTESTS") == "yes":
+        print("Unset BB_SKIP_NETTESTS to run network tests")
+    else:
+        def test_git_latest_versionstring(self):
+            for k, v in self.test_git_uris.items():
+                self.d.setVar("SRCREV", k[2])
+                self.d.setVar("GITTAGREGEX", k[3])
+                ud = bb.fetch2.FetchData(k[1], self.d)
+                verstring = ud.method.latest_versionstring(ud, self.d)
+                r = bb.utils.vercmp_string(v, verstring)
+                self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))
+
+        def test_wget_latest_versionstring(self):
+            for k, v in self.test_wget_uris.items():
+                self.d.setVar("REGEX_URI", k[2])
+                self.d.setVar("REGEX", k[3])
+                ud = bb.fetch2.FetchData(k[1], self.d)
+                verstring = ud.method.latest_versionstring(ud, self.d)
+                r = bb.utils.vercmp_string(v, verstring)
+                self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))




                 reply	other threads:[~2014-12-23 12:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1419337990.6428.3.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.