fix preview test error with python3.x 45/284245/4
authorbiao716.wang <biao716.wang@samsung.com>
Mon, 14 Nov 2022 07:34:15 +0000 (16:34 +0900)
committerbiao716.wang <biao716.wang@samsung.com>
Wed, 30 Nov 2022 05:51:13 +0000 (14:51 +0900)
Change-Id: Id0525f0029a06625ea738bff3f40c0ebcc1c5393
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
gitbuildsys/conf.py
gitbuildsys/utils.py
tests/test_changelog.py
tests/test_export.py
tests/test_help.py
tests/test_import.py

index 71d478b8f7ab803eaa96be6dc56231069123613e..333c59527b3c53d568cd32fa37bbea638b24ffff 100644 (file)
@@ -377,23 +377,32 @@ url = http://download.tizen.org/releases/daily/trunk/ivi/latest/
 
     def _get(self, opt, section='general'):
         'get value from multi-levels of config file'
+        sect_found = True
+        global gerr
         for cfgparser in self._cfgparsers:
             try:
                 return cfgparser.get(section, opt)
             except Error as err:
-                raise errors.ConfigError(err)
+                sect_found = False
+                gerr = err
+                pass
+
+        if not sect_found:
+            raise errors.ConfigError(gerr)
 
     def options(self, section='general'):
         'merge and return options of certain section from multi-levels'
         sect_found = False
-        global gerr
         options = set()
         for cfgparser in self._cfgparsers:
             try:
                 options.update(cfgparser.options(section))
                 sect_found = True
             except Error as err:
-                raise errors.ConfigError(err)
+                pass
+
+        if not sect_found:
+            raise errors.ConfigError(err)
 
         return options
 
index becd0fdf9b36fc5ecc504bd7637f11f8cb6c63e5..1039c226303f6f3b2e66b20d4ae73523dd44c445 100644 (file)
@@ -280,7 +280,7 @@ class URLGrabber(object):
 
         log.debug("fetching %s => %s" % (url, filename))
 
-        with open(filename, 'w') as outfile:
+        with open(filename, 'wb') as outfile:
             self.change_url(url, outfile, user, passwd, no_cache)
             self.perform()
 
@@ -440,7 +440,7 @@ class RepoParser(object):
                     fh_gz = open(fname, 'r')
                 buildconf_file = os.path.join(os.path.dirname(fname),
                                               'build.conf')
-                buildconf_fh = open(buildconf_file, 'w')
+                buildconf_fh = open(buildconf_file, 'wb')
                 buildconf_fh.write(fh_gz.read())
                 fh_gz.close()
                 buildconf_fh.close()
index 1078863a2411c095eb1c5654244ffcdf517bf29c..a93c09f9daf6c8c574b8b63b7291fb50bd5ef9d6 100644 (file)
@@ -32,7 +32,7 @@ from gbp.git.repository import GitRepository
 
 from gitbuildsys.errors import GbsError
 
-GBS = SourceFileLoader("gbs", "../tools/gbs").load_module().main
+GBS = SourceFileLoader("gbs", "./tools/gbs").load_module().main
 ENV = {}
 
 TEST_SPEC_CONTENT = """
index a1bfe16c53a90ecce7b9525a41312c64ddf8f184..007f5e2f1e048893d3baf8296c3765170087fe3b 100644 (file)
@@ -8,7 +8,7 @@ import shutil
 import tempfile
 from nose.tools import eq_
 
-GBS = SourceFileLoader("gbs", "../tools/gbs").load_module().main
+GBS = SourceFileLoader("gbs", "./tools/gbs").load_module().main
 class TestExport(unittest.TestCase):
     """Test export output of gbs commands"""
 
index ccb77f9c078ea96f3566778fe4e67b4566b75035..643fee5b252bdcdb06eb7623c88df49b916a7c74 100644 (file)
@@ -23,7 +23,7 @@ from importlib.machinery import SourceFileLoader
 
 from nose.tools import eq_
 
-GBS = SourceFileLoader("gbs", "../tools/gbs").load_module().main
+GBS = SourceFileLoader("gbs", "./tools/gbs").load_module().main
 class TestHelp(unittest.TestCase):
     """Test help output of gbs commands"""
 
index 512dd713403c919376c4e10c024ff5efea6ac9c8..494a7179adb0110d4432a5e3087ecfe18f61aa38 100644 (file)
@@ -32,7 +32,7 @@ from gitbuildsys.errors import GbsError
 
 from gbp.git.repository import GitRepository
 
-GBS = SourceFileLoader("gbs", "../tools/gbs").load_module().main
+GBS = SourceFileLoader("gbs", "./tools/gbs").load_module().main
 
 def with_data(fname):
     """