-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
No longer support checking Python 2 #13135
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
mypy/test/helpers.py
Outdated
@@ -287,6 +287,7 @@ def num_skipped_suffix_lines(a1: List[str], a2: List[str]) -> int: | |||
|
|||
def testfile_pyversion(path: str) -> Tuple[int, int]: | |||
if path.endswith('python2.test'): | |||
raise ValueError(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just remove this case?
@@ -296,6 +297,7 @@ def testfile_pyversion(path: str) -> Tuple[int, int]: | |||
|
|||
def testcase_pyversion(path: str, testcase_name: str) -> Tuple[int, int]: | |||
if testcase_name.endswith('python2'): | |||
raise ValueError(testcase_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
mypy/test/testdeps.py
Outdated
@@ -30,6 +30,7 @@ def run_case(self, testcase: DataDrivenTestCase) -> None: | |||
dump_all = '# __dump_all__' in src | |||
options = parse_options(src, testcase, incremental_step=1) | |||
if testcase.name.endswith('python2'): | |||
raise ValueError(testcase.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And again
mypy/test/testparse.py
Outdated
@@ -32,6 +32,7 @@ def test_parser(testcase: DataDrivenTestCase) -> None: | |||
options = Options() | |||
|
|||
if testcase.file.endswith('python2.test'): | |||
raise ValueError(testcase.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
mypy/test/testpythoneval.py
Outdated
@@ -61,13 +57,7 @@ def test_python_evaluation(testcase: DataDrivenTestCase, cache_dir: str) -> None | |||
] | |||
py2 = testcase.name.lower().endswith('python2') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left those in semi-intentionally, since it proves this removes all tests, before it removes the test scaffolding. But I can remove them
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still lots of python2 specific logic pieces in checker.py
and checkmember.py
(probably somewhere else), but this is a great start!
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love to see so many negative lines!
Looks good, but I found a few test cases that might still be relevant after Python 2 support has been dropped. Can you double check them? Feel free to merge afterwards.
@@ -130,30 +130,6 @@ two/mod/__init__.py: note: See https://mypy.readthedocs.io/en/stable/running_myp | |||
two/mod/__init__.py: note: Common resolutions include: a) using `--exclude` to avoid checking one of them, b) adding `__init__.py` somewhere, c) using `--explicit-package-bases` or adjusting MYPYPATH | |||
== Return code: 2 | |||
|
|||
[case testFlagsFile] | |||
# cmd: mypy @flagsfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There doesn't seem to be any other test case that uses @flagsfile
, so this test case should not be deleted. We should just change it to use some other flags.
except ZeroDivisionError, err: | ||
print err | ||
|
||
[case testConfigFile] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to above, this doesn't look Python 2 specific as such, but tests using mypy.ini
. Please update the test case to use some other config file option.
test-data/unit/cmdline.test
Outdated
@@ -166,18 +142,6 @@ def f() -> None: | |||
main.py: note: In function "f": | |||
main.py:2: error: Unsupported operand types for + ("int" and "str") | |||
|
|||
[case testAltConfigFile] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to above -- keep this test case but use some other config file option.
@@ -2158,23 +2158,6 @@ main.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#mis | |||
main.py:2: error: Incompatible types in assignment (expression has type "int", variable has type "str") | |||
== | |||
|
|||
[case testMissingStubAdded2] | |||
# flags: --follow-imports=skip --py2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test case might still be relevant. I think that it's better to just drop the --py2
flag but keep the test case.
Thanks, brought back the test cases you mentioned. I was running into some weird issues with testFlagsFile that I couldn't quite figure out — mypy's behaviour outside of the test suite is correct, so I skipped it for now. If I'm not able to figure it out soon, I'll file an issue and fix asynchronously. |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
I think we should go ahead with this and fix |
Linking #12237