From 7b1632e8e390a3e8a82015b476a2c5c60313ff60 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Sat, 8 Feb 2020 02:08:04 +0000 Subject: [PATCH] Fix type error in TornadoImporter --- salt/__init__.py | 2 +- tests/unit/test_ext.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/salt/__init__.py b/salt/__init__.py index 3e99d2439a21..117523b1d268 100644 --- a/salt/__init__.py +++ b/salt/__init__.py @@ -12,7 +12,7 @@ class TornadoImporter(object): - def find_module(self, module_name, package_path): + def find_module(self, module_name, package_path=None): if module_name.startswith('tornado'): return self return None diff --git a/tests/unit/test_ext.py b/tests/unit/test_ext.py index 1cd857208634..3080147d9e75 100644 --- a/tests/unit/test_ext.py +++ b/tests/unit/test_ext.py @@ -14,6 +14,7 @@ import tests.support.helpers # Import Salt libs +import salt import salt.ext.six import salt.modules.cmdmod import salt.utils.platform @@ -95,3 +96,10 @@ def test_vendored_tornado_import_from(self): log.error("Test found bad line: %s", line) valid_lines.append(line) assert valid_lines == [], len(valid_lines) + + def test_regression_56063(self): + importer = salt.TornadoImporter() + try: + importer.find_module('tornado') + except TypeError: + assert False, 'TornadoImporter raised type error when one argument passed'