Salt now has a salt-rewrite in-place which fixes tornado imports

This commit is contained in:
Pedro Algarvio 2021-03-01 03:49:35 +00:00
parent 054e7a3e3a
commit 3563f1fbcc

View file

@ -9,13 +9,11 @@ import salt.modules.cmdmod
import salt.utils.files
import salt.utils.platform
import tests.support.helpers
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import TestCase, skipIf
from tests.support.unit import TestCase
log = logging.getLogger(__name__)
@skipIf(not salt.utils.path.which("bash"), "Bash needed for this test")
class VendorTornadoTest(TestCase):
"""
Ensure we are not using any non vendor'ed tornado
@ -55,38 +53,6 @@ class VendorTornadoTest(TestCase):
pout = p.stdout.read().strip().decode()
assert pout == "salt.ext.tornado", pout
def test_vendored_tornado_import(self):
grep_call = salt.modules.cmdmod.run_stdout(
cmd="bash -c 'grep -r \"import tornado\" ./salt/*'",
cwd=RUNTIME_VARS.CODE_DIR,
ignore_retcode=True,
).split("\n")
valid_lines = []
for line in grep_call:
if line == "":
continue
# Skip salt/ext/tornado/.. since there are a bunch of imports like
# this in docstrings.
if "salt/ext/tornado/" in line:
continue
log.error("Test found bad line: %s", line)
valid_lines.append(line)
assert valid_lines == [], len(valid_lines)
def test_vendored_tornado_import_from(self):
grep_call = salt.modules.cmdmod.run_stdout(
cmd="bash -c 'grep -r \"from tornado\" ./salt/*'",
cwd=RUNTIME_VARS.CODE_DIR,
ignore_retcode=True,
).split("\n")
valid_lines = []
for line in grep_call:
if line == "":
continue
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: