You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do we want blanket fixes over all tests so that names are only referenced after they are bound?
Or do we want to leave some tests incorrect so that we can validate that mypy correctly errors for them?
Also, @spkersten, can you point me to your changes that enable mypy to detect this issue?
I'd define a few separate tests that check for various kinds of forward references (e.g. module, class, function, nested class, type variable, type alias, other kind of variable). Though it's possible that mypy needs to be fixed first to actually error out on them. It's also possible that we should fix the tests without fixing this in mypy (maybe fixing this in mypy is tricky, and of course it must still support forward references from type comments or type annotations in string literals).
Going by @gvanrossum comment, it seems that we want to make a separate set of tests to test forward references. Therefore I will move forward on my quest to fix all mis-referenced tests I can find
So right now I'm writing a test suite that tries to exec all the test cases and report their failure.
My next task will be blacklisting the test-files that shouldn't be run (testing the pyi stuff), as well as
the files/test cases that should intentionally fail
Activity
JukkaL commentedon May 19, 2015
Yeah, this is unfortunate.
JukkaL commentedon Jun 3, 2016
Many of these cases can likely be found using the test data parser used for running test cases and regular expressions.
ArgentFalcon commentedon Jun 3, 2016
I'm looking into this
ArgentFalcon commentedon Jun 3, 2016
Do we want blanket fixes over all tests so that names are only referenced after they are bound?
Or do we want to leave some tests incorrect so that we can validate that mypy correctly errors for them?
Also, @spkersten, can you point me to your changes that enable mypy to detect this issue?
gvanrossum commentedon Jun 3, 2016
I'd define a few separate tests that check for various kinds of forward references (e.g. module, class, function, nested class, type variable, type alias, other kind of variable). Though it's possible that mypy needs to be fixed first to actually error out on them. It's also possible that we should fix the tests without fixing this in mypy (maybe fixing this in mypy is tricky, and of course it must still support forward references from type comments or type annotations in string literals).
ArgentFalcon commentedon Jun 3, 2016
Going by @gvanrossum comment, it seems that we want to make a separate set of tests to test forward references. Therefore I will move forward on my quest to fix all mis-referenced tests I can find
ArgentFalcon commentedon Jun 4, 2016
So right now I'm writing a test suite that tries to
execall the test cases and report their failure.My next task will be blacklisting the test-files that shouldn't be run (testing the pyi stuff), as well as
the files/test cases that should intentionally fail
hauntsaninja commentedon Sep 25, 2022
yup, still open, feel free to work on it. see https://github.com/python/mypy/blob/master/CONTRIBUTING.md#first-time-contributors
JukkaL commentedon Apr 22, 2023
I think that this was addressed in #14166.