diff --git a/docs/changes.rst b/docs/changes.rst index d90efe32..35bc0555 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -35,6 +35,8 @@ Released: not yet The function display_cim_objects(...) uses valuemapping_for_property() but specifies the default namespace as the target. (See issue #995) +* Fixed issues raised by new Pylint version 2.9. + **Enhancements:** **Cleanup:** diff --git a/pywbemtools/pywbemcli/_common.py b/pywbemtools/pywbemcli/_common.py index f34a0908..1f4d8e59 100644 --- a/pywbemtools/pywbemcli/_common.py +++ b/pywbemtools/pywbemcli/_common.py @@ -25,6 +25,7 @@ try: from collections.abc import Sequence except ImportError: + # pylint: disable=deprecated-class from collections import Sequence import six diff --git a/pywbemtools/pywbemlistener/_cmd_listener.py b/pywbemtools/pywbemlistener/_cmd_listener.py index c5a53e57..ab7d5d2b 100644 --- a/pywbemtools/pywbemlistener/_cmd_listener.py +++ b/pywbemtools/pywbemlistener/_cmd_listener.py @@ -425,6 +425,9 @@ def get_listeners(name=None): args = parse_listener_args(listener_args) if args: if name is None or args.name == name: + # pylint: disable=no-member + # Note: This is a workaround for Pylint raising no-member on + # Python 3.9 (see issue #1001) logfile = get_logfile(args.logdir, args.name) lis = ListenerProperties( name=args.name, port=args.port, scheme=args.scheme, @@ -433,6 +436,8 @@ def get_listeners(name=None): indi_file=args.indi_file, indi_format=args.indi_format, logfile=logfile, pid=p.pid, created=datetime.fromtimestamp(p.create_time())) + # pylint: enable=no-member + # Note: End of workaround ret.append(lis) return ret diff --git a/tests/unit/pywbemcli/test_pywbem_server.py b/tests/unit/pywbemcli/test_pywbem_server.py index f55e11cb..1ba28d06 100644 --- a/tests/unit/pywbemcli/test_pywbem_server.py +++ b/tests/unit/pywbemcli/test_pywbem_server.py @@ -549,7 +549,8 @@ def test_pysvr_connect_attrs(testcase, init_kwargs, exp_attrs): # Create temp fake file. # NOTE: We cannot use fixtures because we are using simplified_test_function - open(FAKE_PEM_PATH, 'a').close() + with open(FAKE_PEM_PATH, 'a'): + pass # connect and test connection results. Try block insures finally is # called. diff --git a/tests/unit/utils.py b/tests/unit/utils.py index d88523de..207e1705 100644 --- a/tests/unit/utils.py +++ b/tests/unit/utils.py @@ -24,6 +24,7 @@ try: from collections.abc import Mapping, Sequence except ImportError: + # pylint: disable=deprecated-class from collections import Mapping, Sequence try: from StringIO import StringIO # Python 2 @@ -249,8 +250,7 @@ def execute_command(cmdname, args, env=None, stdin=None, verbose=False, rc = proc.returncode # Restore environment of current process - for name in saved_env: - value = saved_env[name] + for name, value in saved_env.items(): if value is None: del os.environ[name] else: