[PATCH V2 0/3] Fix make check-local issues

V2: Add path 3/3 - fix RuntimeWarning in check_i18n.py Lucio Correia (3): Fix name mismatch with imported module Fix PEP8 issues Fix RuntimeWarning in check_i18n.py src/wok/config.py.in | 19 +++++++++++-------- src/wok/plugins/kimchi/contrib/check_i18n.py | 2 +- src/wok/plugins/kimchi/model/host.py | 4 ++-- src/wok/plugins/kimchi/tests/test_config.py.in | 1 - src/wok/plugins/kimchi/tests/test_host.py | 5 ++--- 5 files changed, 16 insertions(+), 15 deletions(-)

Signed-off-by: Lucio Correia <luciojhc@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/model/host.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wok/plugins/kimchi/model/host.py b/src/wok/plugins/kimchi/model/host.py index ddfbf0f..f32cf62 100644 --- a/src/wok/plugins/kimchi/model/host.py +++ b/src/wok/plugins/kimchi/model/host.py @@ -338,12 +338,12 @@ class DevicesModel(object): xmlstr = dom.XMLDesc(0) root = objectify.fromstring(xmlstr) try: - hostdev = root.devices.hostdev + hostDevices = root.devices.hostdev except AttributeError: continue vm_devs = [DeviceModel.deduce_dev_name(e, self.conn) - for e in hostdev] + for e in hostDevices] for dev in vm_devs: unavailable_devs.append(dev) -- 1.7.1

Signed-off-by: Lucio Correia <luciojhc@linux.vnet.ibm.com> --- src/wok/config.py.in | 19 +++++++++++-------- src/wok/plugins/kimchi/tests/test_config.py.in | 1 - src/wok/plugins/kimchi/tests/test_host.py | 5 ++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/wok/config.py.in b/src/wok/config.py.in index 3540aea..c4e1c65 100644 --- a/src/wok/config.py.in +++ b/src/wok/config.py.in @@ -41,14 +41,17 @@ FONT_FILES = {'fontawesome': ['fontawesome-webfont.ttf'], 'OpenSans-Regular.ttf']} FONTS_PATH = { - 'fontawesome': - ['/usr/share/fonts/fontawesome', - '/usr/share/fonts/truetype/font-awesome', - '/usr/share/fonts/truetype'], - 'opensans': - ['/usr/share/fonts/open-sans', - '/usr/share/fonts/truetype/', - '/usr/share/texlive/texmf-dist/fonts/truetype/public/opensans']} + 'fontawesome': [ + '/usr/share/fonts/fontawesome', + '/usr/share/fonts/truetype/font-awesome', + '/usr/share/fonts/truetype' + ], + 'opensans': [ + '/usr/share/fonts/open-sans', + '/usr/share/fonts/truetype/', + '/usr/share/texlive/texmf-dist/fonts/truetype/public/opensans' + ] +} def get_object_store(): diff --git a/src/wok/plugins/kimchi/tests/test_config.py.in b/src/wok/plugins/kimchi/tests/test_config.py.in index 93ee287..e4db15a 100644 --- a/src/wok/plugins/kimchi/tests/test_config.py.in +++ b/src/wok/plugins/kimchi/tests/test_config.py.in @@ -163,7 +163,6 @@ class ConfigTests(unittest.TestCase): wok_config = WokConfig() self.assertEquals(wok_config, configObj) - def test_kimchi_config(self): KimchiPaths.get_prefix = PluginPaths.get_prefix = get_prefix paths = KimchiPaths() diff --git a/src/wok/plugins/kimchi/tests/test_host.py b/src/wok/plugins/kimchi/tests/test_host.py index a673d8e..f3da49b 100644 --- a/src/wok/plugins/kimchi/tests/test_host.py +++ b/src/wok/plugins/kimchi/tests/test_host.py @@ -209,9 +209,8 @@ class HostTests(unittest.TestCase): resp = self.request('/plugins/kimchi/host/devices?_passthrough=true') all_devs = [dev['name'] for dev in json.loads(resp.read())] - resp = self.request( - '/plugins/kimchi/host/devices?_passthrough=true&_available_only=true' - ) + resp = self.request('/plugins/kimchi/host/devices?' + '_passthrough=true&_available_only=true') available_devs = [dev['name'] for dev in json.loads(resp.read())] self.assertLessEqual(len(available_devs), len(all_devs)) -- 1.7.1

check_i18n.py throws an error trying to import local files (file names preceeded by './'). This patch fixes it by ignoring also the '.' when loading the module. The '.' is still necessary for check_obsolete_messages(). Signed-off-by: Lucio Correia <luciojhc@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/contrib/check_i18n.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/wok/plugins/kimchi/contrib/check_i18n.py b/src/wok/plugins/kimchi/contrib/check_i18n.py index 6a2603c..ac6efc7 100755 --- a/src/wok/plugins/kimchi/contrib/check_i18n.py +++ b/src/wok/plugins/kimchi/contrib/check_i18n.py @@ -37,7 +37,7 @@ BAD_PATTERN = re.compile(r"%\([^)]*?\)") def load_i18n_module(i18nfile): path = os.path.dirname(i18nfile) - mname = i18nfile.replace("/", "_").rstrip(".py") + mname = i18nfile.replace("./", "_").replace("/", "_").rstrip(".py") mobj = imp.find_module("i18n", [path]) return imp.load_module(mname, *mobj) -- 1.7.1

Reviewed-by: Daniel Barboza <dhbarboza82@gmail.com> Tested-by: Daniel Barboza <dhbarboza82@gmail.com> On 10/02/2015 10:32 AM, Lucio Correia wrote:
V2: Add path 3/3 - fix RuntimeWarning in check_i18n.py
Lucio Correia (3): Fix name mismatch with imported module Fix PEP8 issues Fix RuntimeWarning in check_i18n.py
src/wok/config.py.in | 19 +++++++++++-------- src/wok/plugins/kimchi/contrib/check_i18n.py | 2 +- src/wok/plugins/kimchi/model/host.py | 4 ++-- src/wok/plugins/kimchi/tests/test_config.py.in | 1 - src/wok/plugins/kimchi/tests/test_host.py | 5 ++--- 5 files changed, 16 insertions(+), 15 deletions(-)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

Tested-By: Paulo Vital <pvital@linux.vnet.ibm.com> Reviewed-By: Paulo Vital <pvital@linux.vnet.ibm.com> On Fri, 2015-10-02 at 10:32 -0300, Lucio Correia wrote:
V2: Add path 3/3 - fix RuntimeWarning in check_i18n.py
Lucio Correia (3): Fix name mismatch with imported module Fix PEP8 issues Fix RuntimeWarning in check_i18n.py
src/wok/config.py.in | 19 +++++++++++--- ----- src/wok/plugins/kimchi/contrib/check_i18n.py | 2 +- src/wok/plugins/kimchi/model/host.py | 4 ++-- src/wok/plugins/kimchi/tests/test_config.py.in | 1 - src/wok/plugins/kimchi/tests/test_host.py | 5 ++--- 5 files changed, 16 insertions(+), 15 deletions(-)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
participants (4)
-
Aline Manera
-
Daniel Henrique Barboza
-
Lucio Correia
-
Paulo Ricardo Paz Vital