From 2d6014210e3d90f458f76d275200b7a0da189412 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 11 Jul 2022 14:06:29 -0700 Subject: [PATCH 1/5] Ignore deprecated-module in access_attr_before_def_false_positive This is because telnetlib is deprecated in Python 3.11. It's hard to see exactly what this is testing - there's no great explanation in-line and the test predates the first commit to the git repo so we don't have a commit message to help. telnetlib will be removed in 3.13, though, so at that point we'll have to figure it out or drop the telnetlib part of the test. Signed-off-by: Adam Williamson --- .../a/access/access_attr_before_def_false_positive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/a/access/access_attr_before_def_false_positive.py b/tests/functional/a/access/access_attr_before_def_false_positive.py index cb978c84c2..c723eb099d 100644 --- a/tests/functional/a/access/access_attr_before_def_false_positive.py +++ b/tests/functional/a/access/access_attr_before_def_false_positive.py @@ -1,5 +1,5 @@ # pylint: disable=invalid-name,too-many-public-methods,attribute-defined-outside-init -# pylint: disable=useless-object-inheritance,too-few-public-methods +# pylint: disable=useless-object-inheritance,too-few-public-methods,deprecated-module """This module demonstrates a possible problem of pyLint with calling __init__ s from inherited classes. Initializations done there are not considered, which results in Error E0203 for From c02b2e3ceab23bf31c6359d62a93d1f06bd7afff Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 11 Jul 2022 14:23:45 -0700 Subject: [PATCH 2/5] Split asyncio.coroutine tests and set max_pyver 3.10 for them iterable_context_py3 includes some checks that we don't emit errors for asyncio.coroutine, but asyncio.coroutine has been removed in Python 3.11, so we need to set a max version of 3.10 for these tests. Signed-off-by: Adam Williamson --- .../functional/i/iterable_context_asyncio.py | 43 +++++++++++++++++++ .../functional/i/iterable_context_asyncio.rc | 2 + tests/functional/i/iterable_context_py3.py | 37 ---------------- 3 files changed, 45 insertions(+), 37 deletions(-) create mode 100644 tests/functional/i/iterable_context_asyncio.py create mode 100644 tests/functional/i/iterable_context_asyncio.rc diff --git a/tests/functional/i/iterable_context_asyncio.py b/tests/functional/i/iterable_context_asyncio.py new file mode 100644 index 0000000000..20a32cefd3 --- /dev/null +++ b/tests/functional/i/iterable_context_asyncio.py @@ -0,0 +1,43 @@ +""" +Checks that we don't erroneously emit not-an-iterable errors for +coroutines built with asyncio.coroutine. + +These decorators were deprecated in 3.8 and removed in 3.10. +""" +# pylint: disable=missing-docstring,too-few-public-methods,unused-argument,bad-mcs-method-argument +# pylint: disable=wrong-import-position +import asyncio + + +@asyncio.coroutine +def coroutine_function_return_none(): + return + + +@asyncio.coroutine +def coroutine_function_return_object(): + return 12 + + +@asyncio.coroutine +def coroutine_function_return_future(): + return asyncio.Future() + + +@asyncio.coroutine +def coroutine_function_pass(): + pass + + +@asyncio.coroutine +def coroutine_generator(): + yield + + +@asyncio.coroutine +def main(): + yield from coroutine_function_return_none() + yield from coroutine_function_return_object() + yield from coroutine_function_return_future() + yield from coroutine_function_pass() + yield from coroutine_generator() diff --git a/tests/functional/i/iterable_context_asyncio.rc b/tests/functional/i/iterable_context_asyncio.rc new file mode 100644 index 0000000000..4e2b748313 --- /dev/null +++ b/tests/functional/i/iterable_context_asyncio.rc @@ -0,0 +1,2 @@ +[testoptions] +max_pyver=3.10 diff --git a/tests/functional/i/iterable_context_py3.py b/tests/functional/i/iterable_context_py3.py index 07eda00f49..c09cba12d0 100644 --- a/tests/functional/i/iterable_context_py3.py +++ b/tests/functional/i/iterable_context_py3.py @@ -16,40 +16,3 @@ class SomeClass(metaclass=Meta): print(i) for i in SomeClass(): # [not-an-iterable] print(i) - - -import asyncio - - -@asyncio.coroutine -def coroutine_function_return_none(): - return - - -@asyncio.coroutine -def coroutine_function_return_object(): - return 12 - - -@asyncio.coroutine -def coroutine_function_return_future(): - return asyncio.Future() - - -@asyncio.coroutine -def coroutine_function_pass(): - pass - - -@asyncio.coroutine -def coroutine_generator(): - yield - - -@asyncio.coroutine -def main(): - yield from coroutine_function_return_none() - yield from coroutine_function_return_object() - yield from coroutine_function_return_future() - yield from coroutine_function_pass() - yield from coroutine_generator() From 5d63025d0760f3c7a070d21f99ec26918b05f719 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 11 Jul 2022 16:35:20 -0700 Subject: [PATCH 3/5] Set max_pyver 3.10 for some deprecations removed in 3.11 The `binhex` module and `binascii.b2a_hqx()` function, which were deprecated in 3.9, are removed entirely in 3.11. Signed-off-by: Adam Williamson --- tests/functional/d/deprecated/deprecated_methods_py39.rc | 1 + tests/functional/d/deprecated/deprecated_module_py39.rc | 1 + .../d/deprecated/deprecated_module_py39_earlier_pyversion.rc | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/functional/d/deprecated/deprecated_methods_py39.rc b/tests/functional/d/deprecated/deprecated_methods_py39.rc index 16b75eea75..062f6df19c 100644 --- a/tests/functional/d/deprecated/deprecated_methods_py39.rc +++ b/tests/functional/d/deprecated/deprecated_methods_py39.rc @@ -1,2 +1,3 @@ [testoptions] min_pyver=3.9 +max_pyver=3.10 diff --git a/tests/functional/d/deprecated/deprecated_module_py39.rc b/tests/functional/d/deprecated/deprecated_module_py39.rc index 16b75eea75..062f6df19c 100644 --- a/tests/functional/d/deprecated/deprecated_module_py39.rc +++ b/tests/functional/d/deprecated/deprecated_module_py39.rc @@ -1,2 +1,3 @@ [testoptions] min_pyver=3.9 +max_pyver=3.10 diff --git a/tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.rc b/tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.rc index 85f6999e08..09ceaa5e54 100644 --- a/tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.rc +++ b/tests/functional/d/deprecated/deprecated_module_py39_earlier_pyversion.rc @@ -3,3 +3,4 @@ py-version=3.8 [testoptions] min_pyver=3.9 +max_pyver=3.10 From de901b3d1724226f1da7b42d0278b2b897101029 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 12 Jul 2022 12:25:04 -0700 Subject: [PATCH 4/5] Change syntax_error test for consistent output Python 3.11 changes the string representation of the SyntaxError triggered by this test - it now says "expected '('" instead of just "invalid syntax". This changes the test to use a different error (incomplete `for` loop) which still has just "invalid syntax" as its description in Python 3.11. This is the same 'bad code' used in the similar `test_stdin_syntaxerror` in the unit tests. Signed-off-by: Adam Williamson --- tests/functional/s/syntax/syntax_error.py | 2 +- tests/functional/s/syntax/syntax_error.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/s/syntax/syntax_error.py b/tests/functional/s/syntax/syntax_error.py index c93df6b05d..a520401125 100644 --- a/tests/functional/s/syntax/syntax_error.py +++ b/tests/functional/s/syntax/syntax_error.py @@ -1 +1 @@ -def toto # [syntax-error] +for # [syntax-error] diff --git a/tests/functional/s/syntax/syntax_error.txt b/tests/functional/s/syntax/syntax_error.txt index 2dafd9eb35..78a055cf66 100644 --- a/tests/functional/s/syntax/syntax_error.txt +++ b/tests/functional/s/syntax/syntax_error.txt @@ -1 +1 @@ -syntax-error:1:10:None:None::invalid syntax (, line 1):UNDEFINED +syntax-error:1:5:None:None::invalid syntax (, line 1):UNDEFINED From 216f17c418ec7d458535aceddd13a448baa35767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Wed, 13 Jul 2022 23:59:48 +0200 Subject: [PATCH 5/5] Update tests/functional/i/iterable_context_asyncio.py --- tests/functional/i/iterable_context_asyncio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/i/iterable_context_asyncio.py b/tests/functional/i/iterable_context_asyncio.py index 20a32cefd3..1012fbee30 100644 --- a/tests/functional/i/iterable_context_asyncio.py +++ b/tests/functional/i/iterable_context_asyncio.py @@ -2,7 +2,7 @@ Checks that we don't erroneously emit not-an-iterable errors for coroutines built with asyncio.coroutine. -These decorators were deprecated in 3.8 and removed in 3.10. +These decorators were deprecated in 3.8 and removed in 3.11. """ # pylint: disable=missing-docstring,too-few-public-methods,unused-argument,bad-mcs-method-argument # pylint: disable=wrong-import-position