Skip to content

Commit 1e5b1fe

Browse files
committed
Skip some tests
1 parent 2cd69e4 commit 1e5b1fe

17 files changed

+60
-101
lines changed

mypy/test/data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,12 @@ def pytest_addoption(parser: Any) -> None:
604604
default=False,
605605
help="Update test data to reflect actual output (supported only for certain tests)",
606606
)
607+
group.addoption(
608+
"--mypy-num-workers",
609+
type=int,
610+
default=0,
611+
help="Run tests using multiple worker processes for each test case",
612+
)
607613
group.addoption(
608614
"--save-failures-to",
609615
default=None,

mypy/test/helpers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,8 @@ def parse_options(
365365

366366
if testcase.config.getoption("--mypy-verbose"):
367367
options.verbosity = testcase.config.getoption("--mypy-verbose")
368+
if testcase.config.getoption("--mypy-num-workers"):
369+
options.num_workers = testcase.config.getoption("--mypy-num-workers")
368370

369371
return options
370372

mypy/test/testcheck.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ def run_case_once(
137137
if options.num_workers:
138138
options.fixed_format_cache = True
139139
if testcase.output_files:
140-
raise pytest.skip("Reports are not supported in parallel mode yet")
140+
raise pytest.skip("Reports are not supported in parallel mode")
141+
if testcase.name.endswith("_no_parallel"):
142+
raise pytest.skip("Test not supported in parallel mode yet")
141143

142144
# Enable some options automatically based on test file name.
143145
if "columns" in testcase.file:

test-data/unit/check-classes.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7683,7 +7683,7 @@ class Child(metaclass=M, thing=0):
76837683
pass
76847684
[builtins fixtures/object_with_init_subclass.pyi]
76857685

7686-
[case testTooManyArgsForObject]
7686+
[case testTooManyArgsForObject_no_parallel]
76877687
class A(thing=5):
76887688
pass
76897689
[out]
@@ -8498,7 +8498,7 @@ def identity_wrapper(func: FuncT) -> FuncT:
84988498
def foo(self: Any) -> str:
84998499
return ""
85008500

8501-
[case testParentClassWithTypeAliasAndSubclassWithMethod]
8501+
[case testParentClassWithTypeAliasAndSubclassWithMethod_no_parallel]
85028502
from typing import Any, Callable, TypeVar
85038503

85048504
class Parent:

test-data/unit/check-flags.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2477,7 +2477,7 @@ cb(lambda x: a) # OK
24772477
fn = lambda x: a
24782478
cb(fn)
24792479

2480-
[case testShowErrorCodeLinks]
2480+
[case testShowErrorCodeLinks_no_parallel]
24812481
# flags: --show-error-codes --show-error-code-links
24822482

24832483
x: int = "" # E: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]

test-data/unit/check-functions.test

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,24 +1224,20 @@ import b
12241224
from d import dec
12251225
@dec
12261226
def f(x: int) -> None: pass
1227-
b.g(1) # E
1227+
b.g(1) # E: Argument 1 to "g" has incompatible type "int"; expected "str"
12281228

12291229
[file b.py]
12301230
import a
12311231
from d import dec
12321232
@dec
12331233
def g(x: str) -> None: pass
1234-
a.f('')
1234+
a.f('') # E: Argument 1 to "f" has incompatible type "str"; expected "int"
12351235

12361236
[file d.py]
12371237
from typing import TypeVar
12381238
T = TypeVar('T')
12391239
def dec(f: T) -> T: return f
12401240

1241-
[out]
1242-
tmp/b.py:5: error: Argument 1 to "f" has incompatible type "str"; expected "int"
1243-
tmp/a.py:5: error: Argument 1 to "g" has incompatible type "int"; expected "str"
1244-
12451241
[case testDecoratorWithNoAnnotationInImportCycle]
12461242
import a
12471243

@@ -1270,23 +1266,19 @@ import b
12701266
from d import dec
12711267
@dec
12721268
def f(x: int) -> str: pass
1273-
b.g(1)()
1269+
b.g(1)() # E: "str" not callable
12741270

12751271
[file b.py]
12761272
import a
12771273
from d import dec
12781274
@dec
12791275
def g(x: int) -> str: pass
1280-
a.f(1)()
1276+
a.f(1)() # E: "str" not callable
12811277

12821278
[file d.py]
12831279
from typing import Callable
12841280
def dec(f: Callable[[int], str]) -> Callable[[int], str]: return f
12851281

1286-
[out]
1287-
tmp/b.py:5: error: "str" not callable
1288-
tmp/a.py:5: error: "str" not callable
1289-
12901282
[case testDecoratorWithCallAndFixedReturnTypeInImportCycle]
12911283
import a
12921284

@@ -1295,50 +1287,40 @@ import b
12951287
from d import dec
12961288
@dec()
12971289
def f(x: int) -> str: pass
1298-
b.g(1)()
1290+
b.g(1)() # E: "str" not callable
12991291

13001292
[file b.py]
13011293
import a
13021294
from d import dec
13031295
@dec()
13041296
def g(x: int) -> str: pass
1305-
a.f(1)()
1297+
a.f(1)() # E: "str" not callable
13061298

13071299
[file d.py]
13081300
from typing import Callable
13091301
def dec() -> Callable[[Callable[[int], str]], Callable[[int], str]]: pass
13101302

1311-
[out]
1312-
tmp/b.py:5: error: "str" not callable
1313-
tmp/a.py:5: error: "str" not callable
1314-
13151303
[case testDecoratorWithCallAndFixedReturnTypeInImportCycleAndDecoratorArgs]
13161304
import a
13171305

13181306
[file a.py]
13191307
import b
13201308
from d import dec
1321-
@dec(1)
1309+
@dec(1) # E: Argument 1 to "dec" has incompatible type "int"; expected "str"
13221310
def f(x: int) -> str: pass
1323-
b.g(1)()
1311+
b.g(1)() # E: "str" not callable
13241312

13251313
[file b.py]
13261314
import a
13271315
from d import dec
1328-
@dec(1)
1316+
@dec(1) # E: Argument 1 to "dec" has incompatible type "int"; expected "str"
13291317
def g(x: int) -> str: pass
1330-
a.f(1)()
1318+
a.f(1)() # E: "str" not callable
13311319

13321320
[file d.py]
13331321
from typing import Callable
13341322
def dec(x: str) -> Callable[[Callable[[int], str]], Callable[[int], str]]: pass
13351323

1336-
[out]
1337-
tmp/b.py:3: error: Argument 1 to "dec" has incompatible type "int"; expected "str"
1338-
tmp/b.py:5: error: "str" not callable
1339-
tmp/a.py:3: error: Argument 1 to "dec" has incompatible type "int"; expected "str"
1340-
tmp/a.py:5: error: "str" not callable
1341-
13421324
[case testUndefinedDecoratorInImportCycle]
13431325
# cmd: mypy -m foo.base
13441326
[file foo/__init__.py]

test-data/unit/check-ignore.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ bar(Child())
198198
[out]
199199
main:19: error: Argument 1 to "bar" has incompatible type "Child"; expected "Base[str, str]"
200200

201-
[case testTypeIgnoreLineNumberWithinFile]
201+
[case testTypeIgnoreLineNumberWithinFile_no_parallel]
202202
import m
203203
pass # type: ignore
204204
m.f(kw=1)

test-data/unit/check-incremental.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6902,7 +6902,7 @@ class TheClass:
69026902
tmp/a.py:3: note: Revealed type is "def (value: builtins.object) -> lib.TheClass.pyenum@6"
69036903

69046904

6905-
[case testIncrementalFunctoolsPartial]
6905+
[case testIncrementalFunctoolsPartial_no_parallel]
69066906
import a
69076907

69086908
[file a.py]

test-data/unit/check-inference.test

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,7 +1747,7 @@ def f(blocks: Any): # E: Name "Any" is not defined \
17471747
to_process = list(blocks)
17481748
[builtins fixtures/list.pyi]
17491749

1750-
[case testSpecialCaseEmptyListInitialization2]
1750+
[case testSpecialCaseEmptyListInitialization2_no_parallel]
17511751
def f(blocks: object):
17521752
to_process = []
17531753
to_process = list(blocks) # E: No overload variant of "list" matches argument type "object" \
@@ -3644,17 +3644,14 @@ class A:
36443644
import a
36453645
[file a.py]
36463646
import b
3647-
reveal_type(b.B.x)
3647+
reveal_type(b.B.x) # N: Revealed type is "builtins.int"
36483648
class A:
36493649
x = 42
36503650
[file b.py]
36513651
import a
3652-
reveal_type(a.A.x)
3652+
reveal_type(a.A.x) # N: Revealed type is "builtins.int"
36533653
class B:
36543654
x = 42
3655-
[out]
3656-
tmp/b.py:2: note: Revealed type is "builtins.int"
3657-
tmp/a.py:2: note: Revealed type is "builtins.int"
36583655

36593656
[case testUnionTypeCallableInference]
36603657
from typing import Callable, Type, TypeVar, Union

test-data/unit/check-kwargs.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ class A:
464464
pass
465465
A.B(x=1) # E: Unexpected keyword argument "x" for "B"
466466

467-
[case testUnexpectedMethodKwargFromOtherModule]
467+
[case testUnexpectedMethodKwargFromOtherModule_no_parallel]
468468
import m
469469
m.A(x=1)
470470
[file m.py]

0 commit comments

Comments
 (0)