Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor ansible-test code cleanup. #59052

Merged
merged 2 commits into from
Jul 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/runner/injector/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ def main():
# noinspection PyUnresolvedReferences
found = bool(importlib.util.find_spec('coverage'))
else:
# noinspection PyDeprecation
import imp

try:
# noinspection PyDeprecation
imp.find_module('coverage')
found = True
except ImportError:
Expand Down
3 changes: 3 additions & 0 deletions test/runner/lib/cloud/hcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ class HcloudCloudEnvironment(CloudEnvironment):
"""

def get_environment_config(self):
"""
:rtype: CloudEnvironmentConfig
"""
parser = ConfigParser()
parser.read(self.config_path)

Expand Down
4 changes: 2 additions & 2 deletions test/runner/lib/sanity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def command_sanity(args):

def collect_code_smell_tests():
"""
:rtype: tuple[SanityCodeSmellTest]
:rtype: tuple[SanityFunc]
"""
skip_file = 'test/sanity/code-smell/skip.txt'
skip_tests = read_lines_without_comments(skip_file, remove_blank_lines=True, optional=True)
Expand Down Expand Up @@ -383,7 +383,7 @@ def test(self, args, targets, python_version):
def sanity_init():
"""Initialize full sanity test list (includes code-smell scripts determined at runtime)."""
import_plugins('sanity')
sanity_plugins = {} # type: t.Dict[str, type]
sanity_plugins = {} # type: t.Dict[str, t.Type[SanityFunc]]
load_plugins(SanityFunc, sanity_plugins)
sanity_tests = tuple([plugin() for plugin in sanity_plugins.values()])
global SANITY_TESTS # pylint: disable=locally-disabled, global-statement
Expand Down
4 changes: 3 additions & 1 deletion test/runner/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# noinspection PyCompatibility
from configparser import ConfigParser
except ImportError:
# noinspection PyCompatibility
# noinspection PyCompatibility,PyUnresolvedReferences
from ConfigParser import SafeConfigParser as ConfigParser

try:
Expand Down Expand Up @@ -788,9 +788,11 @@ def load_module(path, name): # type: (str, str) -> None

sys.modules[name] = module
else:
# noinspection PyDeprecation
import imp

with open(path, 'r') as module_file:
# noinspection PyDeprecation
imp.load_module(name, module_file, path, ('.py', 'r', imp.PY_SOURCE))


Expand Down