mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 05:11:25 -07:00
Bug fixes and cleanup for ansible-test. (#45991)
* Remove unused imports. * Clean up ConfigParser usage in ansible-test. * Fix bare except statements in ansible-test. * Miscellaneous cleanup from PyCharm inspections. * Enable pylint no-self-use for ansible-test. * Remove obsolete pylint ignores for Python 3.7. * Fix shellcheck issuers under newer shellcheck. * Use newer path for ansible-test. * Fix issues in code-smell tests.
This commit is contained in:
parent
b60854357b
commit
ac492476e5
24 changed files with 36 additions and 128 deletions
|
@ -5,7 +5,6 @@ from __future__ import absolute_import, print_function
|
|||
import atexit
|
||||
import contextlib
|
||||
import errno
|
||||
import filecmp
|
||||
import fcntl
|
||||
import inspect
|
||||
import json
|
||||
|
@ -32,6 +31,13 @@ except ImportError:
|
|||
from abc import ABCMeta
|
||||
ABC = ABCMeta('ABC', (), {})
|
||||
|
||||
try:
|
||||
# noinspection PyCompatibility
|
||||
from ConfigParser import SafeConfigParser as ConfigParser
|
||||
except ImportError:
|
||||
# noinspection PyCompatibility
|
||||
from configparser import ConfigParser
|
||||
|
||||
DOCKER_COMPLETION = {}
|
||||
|
||||
coverage_path = '' # pylint: disable=locally-disabled, invalid-name
|
||||
|
@ -117,10 +123,10 @@ def find_executable(executable, cwd=None, path=None, required=True):
|
|||
match = executable
|
||||
else:
|
||||
if path is None:
|
||||
path = os.environ.get('PATH', os.defpath)
|
||||
path = os.environ.get('PATH', os.path.defpath)
|
||||
|
||||
if path:
|
||||
path_dirs = path.split(os.pathsep)
|
||||
path_dirs = path.split(os.path.pathsep)
|
||||
seen_dirs = set()
|
||||
|
||||
for path_dir in path_dirs:
|
||||
|
@ -197,7 +203,7 @@ def intercept_command(args, cmd, target_name, capture=False, env=None, data=None
|
|||
coverage_file = os.path.abspath(os.path.join(inject_path, '..', 'output', '%s=%s=%s=%s=coverage' % (
|
||||
args.command, target_name, args.coverage_label or 'local-%s' % version, 'python-%s' % version)))
|
||||
|
||||
env['PATH'] = inject_path + os.pathsep + env['PATH']
|
||||
env['PATH'] = inject_path + os.path.pathsep + env['PATH']
|
||||
env['ANSIBLE_TEST_PYTHON_VERSION'] = version
|
||||
env['ANSIBLE_TEST_PYTHON_INTERPRETER'] = interpreter
|
||||
|
||||
|
@ -388,7 +394,7 @@ def common_environment():
|
|||
"""Common environment used for executing all programs."""
|
||||
env = dict(
|
||||
LC_ALL='en_US.UTF-8',
|
||||
PATH=os.environ.get('PATH', os.defpath),
|
||||
PATH=os.environ.get('PATH', os.path.defpath),
|
||||
)
|
||||
|
||||
required = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue