Repository navigation
[WIP] Tests without builtins fixtures #3189
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
Changes from all commits
14a8534
16a0ef6
25ca546
afb7aae
5364461
206eecb
01cd538
97fdddf
cd32a05
5989124
575c0e8
00e7b63
564aeae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,10 @@ | ||
| import os | ||
| PYTHON2_VERSION = (2, 7) | ||
| PYTHON3_VERSION = (3, 6) | ||
| CACHE_DIR = '.mypy_cache' | ||
| CONFIG_FILE = 'mypy.ini' | ||
| # Set this to False (here in the file, not dynamically!) to disable builtins fixtures in tests | ||
|
|
||
|
|
||
| def allow_fixtures() -> bool: | ||
| return not os.environ.get('NO_BUILTINS_FIXTURES', False) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -670,45 +670,45 @@ def f(x: str) -> None: pass | |
| [case testTypeCheckNamedModule] | ||
| # cmd: mypy -m m.a | ||
| [file m/__init__.py] | ||
| None + 1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you replace
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only replaced the cases where the intent is to check whether mypy gets to a given line. The test basically assumes that
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC, some tests are actually run with automatic addition of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It shouldn't change. But apart from flags added to tests, and tests inside typeshed, and
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I am not, but I assumed this, since the tests were passing before, i.e. were giving an error for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was just because in the builtins fixture |
||
| object() + 1 | ||
| [file m/a.py] | ||
| [out] | ||
| tmp/m/__init__.py:1: error: Unsupported left operand type for + (None) | ||
| tmp/m/__init__.py:1: error: Unsupported left operand type for + ("object") | ||
|
|
||
| [case testTypeCheckNamedModule2] | ||
| # cmd: mypy -m m.a | ||
| [file m/__init__.py] | ||
| [file m/a.py] | ||
| None + 1 | ||
| object() + 1 | ||
| [out] | ||
| tmp/m/a.py:1: error: Unsupported left operand type for + (None) | ||
| tmp/m/a.py:1: error: Unsupported left operand type for + ("object") | ||
|
|
||
| [case testTypeCheckNamedModule3] | ||
| # cmd: mypy -m m | ||
| [file m/__init__.py] | ||
| None + 1 | ||
| object() + 1 | ||
| [file m/a.py] | ||
| [out] | ||
| tmp/m/__init__.py:1: error: Unsupported left operand type for + (None) | ||
| tmp/m/__init__.py:1: error: Unsupported left operand type for + ("object") | ||
|
|
||
| [case testTypeCheckNamedModule4] | ||
| # cmd: mypy -m m | ||
| [file m/__init__.py] | ||
| [file m/a.py] | ||
| None + 1 # Not analyzed. | ||
| object() + 1 # Not analyzed. | ||
| [out] | ||
|
|
||
| [case testTypeCheckNamedModule5] | ||
| # cmd: mypy -m m | ||
| None + '' # Not analyzed. | ||
| object() + 1 # Not analyzed. | ||
| [file m.py] | ||
| None + 1 | ||
| object() + 1 | ||
| [out] | ||
| tmp/m.py:1: error: Unsupported left operand type for + (None) | ||
| tmp/m.py:1: error: Unsupported left operand type for + ("object") | ||
|
|
||
| [case testTypeCheckNamedModuleWithImportCycle] | ||
| # cmd: mypy -m m.a | ||
| None + 1 # Does not generate error, as this file won't be analyzed. | ||
| object() + 1 # Does not generate error, as this file won't be analyzed. | ||
| [file m/__init__.py] | ||
| import m.a | ||
| [file m/a.py] | ||
|
|
||
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.
What is the reason for this change? This looks strange.
Uh oh!
There was an error while loading. Please reload this page.
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.
Because of #3122. This test doesn't actually care about that behavior, it simply wanted to see if
x + 1is allowed. But until #3122 is fixed, the side effect is thatxchanges type in a inconsistent manner without fixtures - making the test fail.