Skip to content

Treat --python-version X.Y and --python-version=X.Y in tests equally #8026

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

Merged
merged 4 commits into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions mypy/test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ def parse_options(program_text: str, testcase: DataDrivenTestCase,
if flags2:
flags = flags2

flag_list = None
if flags:
flag_list = flags.group(1).split()
flag_list.append('--no-site-packages') # the tests shouldn't need an installed Python
Expand All @@ -384,14 +383,14 @@ def parse_options(program_text: str, testcase: DataDrivenTestCase,
# TODO: support specifying targets via the flags pragma
raise RuntimeError('Specifying targets via the flags pragma is not supported.')
else:
flag_list = []
options = Options()
# TODO: Enable strict optional in test cases by default (requires *many* test case changes)
options.strict_optional = False
options.error_summary = False

# Allow custom python version to override testcase_pyversion
if (not flag_list or
all(flag not in flag_list for flag in ['--python-version', '-2', '--py2'])):
# Allow custom python version to override testcase_pyversion.
if all(flag.split('=')[0] not in ['--python-version', '-2', '--py2'] for flag in flag_list):
options.python_version = testcase_pyversion(testcase.file, testcase.name)

if testcase.config.getoption('--mypy-verbose'):
Expand Down
12 changes: 6 additions & 6 deletions test-data/unit/check-literal.test
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ expr_com_3 = ... # type: Literal['3']
expr_com_4 = ... # type: Literal['True']
expr_com_5 = ... # type: Literal['None']
expr_com_6 = ... # type: Literal['"foo"']
reveal_type(expr_com_1) # N: Revealed type is 'Literal['a+b']'
reveal_type(expr_com_2) # N: Revealed type is 'Literal['1+2']'
reveal_type(expr_com_3) # N: Revealed type is 'Literal['3']'
reveal_type(expr_com_4) # N: Revealed type is 'Literal['True']'
reveal_type(expr_com_5) # N: Revealed type is 'Literal['None']'
reveal_type(expr_com_6) # N: Revealed type is 'Literal['"foo"']'
reveal_type(expr_com_1) # N: Revealed type is 'Literal[u'a+b']'
reveal_type(expr_com_2) # N: Revealed type is 'Literal[u'1+2']'
reveal_type(expr_com_3) # N: Revealed type is 'Literal[u'3']'
reveal_type(expr_com_4) # N: Revealed type is 'Literal[u'True']'
reveal_type(expr_com_5) # N: Revealed type is 'Literal[u'None']'
reveal_type(expr_com_6) # N: Revealed type is 'Literal[u'"foo"']'
[builtins fixtures/bool.pyi]
[out]

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy