From 0d3cff0dde0faf9ef4e0afd017f47b9a1c715694 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 14 Jan 2020 08:40:03 -0800 Subject: [PATCH] ltmpl: Update to use collections.abc --- src/pylorax/ltmpl.py | 4 ++-- tests/composer/test_utilities.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pylorax/ltmpl.py b/src/pylorax/ltmpl.py index 88ec9a21..e5ab9332 100644 --- a/src/pylorax/ltmpl.py +++ b/src/pylorax/ltmpl.py @@ -39,7 +39,7 @@ from mako.exceptions import text_error_template import sys, traceback import struct import dnf -import collections +import collections.abc class LoraxTemplate(object): def __init__(self, directories=None): @@ -163,7 +163,7 @@ class TemplateRunner(object): try: # grab the method named in cmd and pass it the given arguments f = getattr(self, cmd, None) - if cmd[0] == '_' or cmd == 'run' or not isinstance(f, collections.Callable): + if cmd[0] == '_' or cmd == 'run' or not isinstance(f, collections.abc.Callable): raise ValueError("unknown command %s" % cmd) f(*args) except Exception: # pylint: disable=broad-except diff --git a/tests/composer/test_utilities.py b/tests/composer/test_utilities.py index d2d02337..2a7a29ae 100644 --- a/tests/composer/test_utilities.py +++ b/tests/composer/test_utilities.py @@ -52,13 +52,13 @@ class CliUtilitiesTest(unittest.TestCase): """Test a result with no status and no error fields""" result = {"foo": "bar"} self.assertEqual(handle_api_result(result, show_json=False), (0, False)) - self.assertTrue(handle_api_result(result, show_json=False)[0] is 0) + self.assertTrue(handle_api_result(result, show_json=False)[0] == 0) def test_api_result_2(self): """Test a result with errors=[{"id": INVALID_CHARS, "msg": "some error"}], and no status field""" result = {"foo": "bar", "errors": [{"id": INVALID_CHARS, "msg": "some error"}]} self.assertEqual(handle_api_result(result, show_json=False), (1, False)) - self.assertTrue(handle_api_result(result, show_json=False)[0] is 1) + self.assertTrue(handle_api_result(result, show_json=False)[0] == 1) def test_api_result_3(self): """Test a result with status=True, and errors=[]"""