[oe-commits] [openembedded-core] branch master updated: buildhistory: skip tests if GitPython module is missing

git at git.openembedded.org git at git.openembedded.org
Wed Jun 7 15:01:26 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

The following commit(s) were added to refs/heads/master by this push:
     new 186882c  buildhistory: skip tests if GitPython module is missing
186882c is described below

commit 186882ca62bf683b93cd7a250963921b89ba071f
Author: Leonardo Sandoval <leonardo.sandoval.gonzalez at linux.intel.com>
AuthorDate: Wed Jun 7 07:41:55 2017 -0700

    buildhistory: skip tests if GitPython module is missing
    
    Catching a possible exception when importing the git module,
    allows us to skip test if the latter is missing on the host.
    Also, import oe.buildhistory_analysis inside fuctions
    because this module also needs git to work correctly.
    
    [YOCTO #11620]
    
    Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/selftest/cases/oelib/buildhistory.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py b/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py
index 4e87751..f9bec53 100644
--- a/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py
+++ b/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py
@@ -1,9 +1,7 @@
 import os
 from oeqa.selftest.case import OESelftestTestCase
 import tempfile
-from git import Repo
 from oeqa.utils.commands import get_bb_var
-from oe.buildhistory_analysis import blob_to_dict, compare_dict_blobs
 
 class TestBlobParsing(OESelftestTestCase):
 
@@ -12,7 +10,12 @@ class TestBlobParsing(OESelftestTestCase):
         self.repo_path = tempfile.mkdtemp(prefix='selftest-buildhistory',
             dir=get_bb_var('TOPDIR'))
 
-        self.repo = Repo.init(self.repo_path)
+        try:
+            from git import Repo
+            self.repo = Repo.init(self.repo_path)
+        except ImportError:
+            self.skipTest('Python module GitPython is not present')
+
         self.test_file = "test"
         self.var_map = {}
 
@@ -40,6 +43,7 @@ class TestBlobParsing(OESelftestTestCase):
         """
         Test convertion of git blobs to dictionary
         """
+        from oe.buildhistory_analysis import blob_to_dict
         valuesmap = { "foo" : "1", "bar" : "2" }
         self.commit_vars(to_add = valuesmap)
 
@@ -51,6 +55,8 @@ class TestBlobParsing(OESelftestTestCase):
         """
         Test comparisson of dictionaries extracted from git blobs
         """
+        from oe.buildhistory_analysis import compare_dict_blobs
+
         changesmap = { "foo-2" : ("2", "8"), "bar" : ("","4"), "bar-2" : ("","5")}
 
         self.commit_vars(to_add = { "foo" : "1", "foo-2" : "2", "foo-3" : "3" })
@@ -69,6 +75,7 @@ class TestBlobParsing(OESelftestTestCase):
         """
         Test default values for comparisson of git blob dictionaries
         """
+        from oe.buildhistory_analysis import compare_dict_blobs
         defaultmap = { x : ("default", "1")  for x in ["PKG", "PKGE", "PKGV", "PKGR"]}
 
         self.commit_vars(to_add = { "foo" : "1" })

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


More information about the Openembedded-commits mailing list