From d16ad25e4b7a8358f3ff374a26aa4df0cc829a5b Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Mon, 10 Jun 2024 19:23:49 -0700 Subject: [PATCH] Remove extraneous pylint ignore (#83257) * Pylint issue 511 is closed, remove ignore related to that. Signed-off-by: Abhijeet Kasurde --- .../executor/module_common/test_module_common.py | 9 ++++----- test/units/module_utils/basic/test_exit_json.py | 12 +++--------- test/units/module_utils/basic/test_log.py | 6 ++---- test/units/module_utils/basic/test_run_command.py | 2 -- test/units/module_utils/basic/test_tmpdir.py | 2 -- test/units/plugins/connection/test_psrp.py | 2 -- test/units/plugins/connection/test_winrm.py | 2 -- 7 files changed, 9 insertions(+), 26 deletions(-) diff --git a/test/units/executor/module_common/test_module_common.py b/test/units/executor/module_common/test_module_common.py index c7edce6b2df..7cdf446f968 100644 --- a/test/units/executor/module_common/test_module_common.py +++ b/test/units/executor/module_common/test_module_common.py @@ -165,19 +165,18 @@ class TestDetectionRegexes: def test_no_detect_new_style_python_module_re(self, testcase): assert not amc.NEW_STYLE_PYTHON_MODULE_RE.search(testcase) - # pylint bug: https://github.com/PyCQA/pylint/issues/511 - @pytest.mark.parametrize('testcase, result', CORE_PATHS) # pylint: disable=undefined-variable + @pytest.mark.parametrize('testcase, result', CORE_PATHS) def test_detect_core_library_path_re(self, testcase, result): assert amc.CORE_LIBRARY_PATH_RE.search(testcase).group('path') == result - @pytest.mark.parametrize('testcase', (p[0] for p in COLLECTION_PATHS)) # pylint: disable=undefined-variable + @pytest.mark.parametrize('testcase', (p[0] for p in COLLECTION_PATHS)) def test_no_detect_core_library_path_re(self, testcase): assert not amc.CORE_LIBRARY_PATH_RE.search(testcase) - @pytest.mark.parametrize('testcase, result', COLLECTION_PATHS) # pylint: disable=undefined-variable + @pytest.mark.parametrize('testcase, result', COLLECTION_PATHS) def test_detect_collection_path_re(self, testcase, result): assert amc.COLLECTION_PATH_RE.search(testcase).group('path') == result - @pytest.mark.parametrize('testcase', (p[0] for p in CORE_PATHS)) # pylint: disable=undefined-variable + @pytest.mark.parametrize('testcase', (p[0] for p in CORE_PATHS)) def test_no_detect_collection_path_re(self, testcase): assert not amc.COLLECTION_PATH_RE.search(testcase) diff --git a/test/units/module_utils/basic/test_exit_json.py b/test/units/module_utils/basic/test_exit_json.py index ef44cecfa01..795e9c1eb6e 100644 --- a/test/units/module_utils/basic/test_exit_json.py +++ b/test/units/module_utils/basic/test_exit_json.py @@ -33,8 +33,6 @@ class TestAnsibleModuleExitJson: {'msg': 'message', 'datetime': DATETIME.isoformat(), 'invocation': EMPTY_INVOCATION}), ) - # pylint bug: https://github.com/PyCQA/pylint/issues/511 - # pylint: disable=undefined-variable @pytest.mark.parametrize('args, expected, stdin', ((a, e, {}) for a, e in DATA), indirect=['stdin']) def test_exit_json_exits(self, am, capfd, args, expected, monkeypatch): monkeypatch.setattr(warnings, '_global_deprecations', []) @@ -47,10 +45,8 @@ class TestAnsibleModuleExitJson: return_val = json.loads(out) assert return_val == expected - # Fail_json is only legal if it's called with a message - # pylint bug: https://github.com/PyCQA/pylint/issues/511 @pytest.mark.parametrize('args, expected, stdin', - ((a, e, {}) for a, e in DATA if 'msg' in a), # pylint: disable=undefined-variable + ((a, e, {}) for a, e in DATA if 'msg' in a), indirect=['stdin']) def test_fail_json_exits(self, am, capfd, args, expected, monkeypatch): monkeypatch.setattr(warnings, '_global_deprecations', []) @@ -141,10 +137,9 @@ class TestAnsibleModuleExitValuesRemoved: ), ) - # pylint bug: https://github.com/PyCQA/pylint/issues/511 @pytest.mark.parametrize('am, stdin, return_val, expected', (({'username': {}, 'password': {'no_log': True}, 'token': {'no_log': True}}, s, r, e) - for s, r, e in DATA), # pylint: disable=undefined-variable + for s, r, e in DATA), indirect=['am', 'stdin']) def test_exit_json_removes_values(self, am, capfd, return_val, expected, monkeypatch): monkeypatch.setattr(warnings, '_global_deprecations', []) @@ -154,10 +149,9 @@ class TestAnsibleModuleExitValuesRemoved: assert json.loads(out) == expected - # pylint bug: https://github.com/PyCQA/pylint/issues/511 @pytest.mark.parametrize('am, stdin, return_val, expected', (({'username': {}, 'password': {'no_log': True}, 'token': {'no_log': True}}, s, r, e) - for s, r, e in DATA), # pylint: disable=undefined-variable + for s, r, e in DATA), indirect=['am', 'stdin']) def test_fail_json_removes_values(self, am, capfd, return_val, expected, monkeypatch): monkeypatch.setattr(warnings, '_global_deprecations', []) diff --git a/test/units/module_utils/basic/test_log.py b/test/units/module_utils/basic/test_log.py index 59fde23fa2f..5b423495c50 100644 --- a/test/units/module_utils/basic/test_log.py +++ b/test/units/module_utils/basic/test_log.py @@ -16,8 +16,7 @@ class TestAnsibleModuleLogSmokeTest: DATA = DATA + [d.encode('utf-8') for d in DATA] DATA += [b'non-utf8 :\xff: test'] - # pylint bug: https://github.com/PyCQA/pylint/issues/511 - @pytest.mark.parametrize('msg, stdin', ((m, {}) for m in DATA), indirect=['stdin']) # pylint: disable=undefined-variable + @pytest.mark.parametrize('msg, stdin', ((m, {}) for m in DATA), indirect=['stdin']) def test_smoketest_syslog(self, am, mocker, msg): # These talk to the live daemons on the system. Need to do this to # show that what we send doesn't cause an issue once it gets to the @@ -55,9 +54,8 @@ class TestAnsibleModuleLogSyslog: else: mock_syslog.assert_called_once_with(syslog.LOG_INFO, 'unittest no_log') - # pylint bug: https://github.com/PyCQA/pylint/issues/511 @pytest.mark.parametrize('msg, param, stdin', - ((m, p, {}) for m, p in OUTPUT_DATA), # pylint: disable=undefined-variable + ((m, p, {}) for m, p in OUTPUT_DATA), indirect=['stdin']) def test_output_matches(self, am, mocker, msg, param): """Check that log messages are sent correctly""" diff --git a/test/units/module_utils/basic/test_run_command.py b/test/units/module_utils/basic/test_run_command.py index 2f77d5f3747..c00ec27187b 100644 --- a/test/units/module_utils/basic/test_run_command.py +++ b/test/units/module_utils/basic/test_run_command.py @@ -126,8 +126,6 @@ class TestRunCommandArgs: ('/bin/ls a " b" "c "', [b'/bin/ls', b'a', b' b', b'c '], b'/bin/ls a " b" "c "'), ) - # pylint bug: https://github.com/PyCQA/pylint/issues/511 - # pylint: disable=undefined-variable @pytest.mark.parametrize('cmd, expected, shell, stdin', ((arg, cmd_str if sh else cmd_lst, sh, {}) for (arg, cmd_lst, cmd_str), sh in product(ARGS_DATA, (True, False))), diff --git a/test/units/module_utils/basic/test_tmpdir.py b/test/units/module_utils/basic/test_tmpdir.py index 65d68011276..aa77c9c695d 100644 --- a/test/units/module_utils/basic/test_tmpdir.py +++ b/test/units/module_utils/basic/test_tmpdir.py @@ -57,8 +57,6 @@ class TestAnsibleModuleTmpDir: ), ) - # pylint bug: https://github.com/PyCQA/pylint/issues/511 - # pylint: disable=undefined-variable @pytest.mark.parametrize('args, expected, stat_exists', ((s, e, t) for s, t, e in DATA)) def test_tmpdir_property(self, monkeypatch, args, expected, stat_exists): makedirs = {'called': False} diff --git a/test/units/plugins/connection/test_psrp.py b/test/units/plugins/connection/test_psrp.py index 7fd6eadd62b..d1c5fe821a5 100644 --- a/test/units/plugins/connection/test_psrp.py +++ b/test/units/plugins/connection/test_psrp.py @@ -198,8 +198,6 @@ class TestConnectionPSRP(object): ), ) - # pylint bug: https://github.com/PyCQA/pylint/issues/511 - # pylint: disable=undefined-variable @pytest.mark.parametrize('options, expected', ((o, e) for o, e in OPTIONS_DATA)) def test_set_options(self, options, expected): diff --git a/test/units/plugins/connection/test_winrm.py b/test/units/plugins/connection/test_winrm.py index c08cdd9d7eb..00a29c97286 100644 --- a/test/units/plugins/connection/test_winrm.py +++ b/test/units/plugins/connection/test_winrm.py @@ -199,8 +199,6 @@ class TestConnectionWinRM(object): ), ) - # pylint bug: https://github.com/PyCQA/pylint/issues/511 - # pylint: disable=undefined-variable @pytest.mark.parametrize('options, direct, expected, kerb', ((o, d, e, k) for o, d, e, k in OPTIONS_DATA)) def test_set_options(self, options, direct, expected, kerb):