Skip to content

Commit

Permalink
Run some tests with new semantic analyzer (python#6335)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilevkivskyi authored Feb 5, 2019
1 parent 615c207 commit 2532be6
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ jobs:
python: 3.6 # 3.6.3 pip 9.0.1
- name: "run test suite with python 3.7"
python: 3.7 # 3.7.0 pip 10.0.1
- name: "run test suite with python 3.7 (new semantic analyzer)"
python: 3.7
env:
- TOXENV=py
- EXTRA_ARGS="-n 12"
- NEWSEMANAL=1
- name: "run test suite with python 3.8-dev"
python: 3.8-dev
- name: "type check our own code"
Expand Down
3 changes: 3 additions & 0 deletions mypy/test/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from typing import List, Tuple, Set, Optional, Iterator, Any, Dict, NamedTuple, Union

from mypy.test.config import test_data_prefix, test_temp_dir, PREFIX
from mypy.test.hacks import new_semanal_blacklist

root_dir = os.path.normpath(PREFIX)

Expand Down Expand Up @@ -196,6 +197,8 @@ def __init__(self,
if ((platform == 'windows' and sys.platform != 'win32')
or (platform == 'posix' and sys.platform == 'win32')):
skip = True
if os.getenv('NEWSEMANAL') and os.path.split(file)[-1] in new_semanal_blacklist:
skip = True
self.skip = skip
self.data = data
self.line = line
Expand Down
80 changes: 80 additions & 0 deletions mypy/test/hacks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
"""This file exists as a temporary measure, and will be removed when new
semantic analyzer is the default one.
"""
MYPY = False
if MYPY:
from typing_extensions import Final

# Files to not run with new semantic analyzer.
new_semanal_blacklist = [
'check-abstract.test',
'check-async-await.test',
'check-attr.test',
'check-basic.test',
'check-bound.test',
'check-callable.test',
'check-classes.test',
'check-classvar.test',
'check-class-namedtuple.test',
'check-custom-plugin.test',
'check-dataclasses.test',
'check-default-plugin.test',
'check-enum.test',
'check-expressions.test',
'check-fastparse.test',
'check-final.test',
'check-flags.test',
'check-functions.test',
'check-generics.test',
'check-ignore.test',
'check-incomplete-fixture.test',
'check-incremental.test',
'check-inference-context.test',
'check-inference.test',
'check-isinstance.test',
'check-literal.test',
'check-modules.test',
'check-multiple-inheritance.test',
'check-namedtuple.test',
'check-newtype.test',
'check-optional.test',
'check-overloading.test',
'check-protocols.test',
'check-python2.test',
'check-redefine.test',
'check-semanal-error.test',
'check-serialize.test',
'check-statements.test',
'check-tuples.test',
'check-type-aliases.test',
'check-typeddict.test',
'check-typevar-values.test',
'check-unions.test',
'check-unreachable-code.test',
'check-varargs.test',
'deps-classes.test',
'deps-expressions.test',
'deps-generics.test',
'deps-statements.test',
'deps-types.test',
'deps.test',
'diff.test',
'fine-grained-cache-incremental.test',
'fine-grained-blockers.test',
'fine-grained-cycles.test',
'fine-grained-modules.test',
'fine-grained.test',
'semanal-abstractclasses.test',
'semanal-basic.test',
'semanal-modules.test',
'semanal-classes.test',
'semanal-classvar.test',
'semanal-errors.test',
'semenal-literal.test',
'semanal-namedtuple.test',
'semanal-statements.test',
'semanal-symtable.test',
'semanal-typealiases.test',
'semanal-typeinfo.test',
'semanal-types.test'
] # type: Final
3 changes: 3 additions & 0 deletions mypy/test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ def parse_options(program_text: str, testcase: DataDrivenTestCase,
if testcase.config.getoption('--mypy-verbose'):
options.verbosity = testcase.config.getoption('--mypy-verbose')

if os.getenv('NEWSEMANAL'):
options.new_semantic_analyzer = True

return options


Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ envlist = py34,

[testenv]
description = run the test driver with {basepython}
passenv = PYTEST_XDIST_WORKER_COUNT
passenv = PYTEST_XDIST_WORKER_COUNT NEWSEMANAL
deps = -rtest-requirements.txt
commands = pytest {posargs}

Expand Down

0 comments on commit 2532be6

Please sign in to comment.