Skip to content

Commit ca24559

Browse files
committed
Fix cmdline package tests for namespace packages
Prep for #9636 First test was failing because a was not a valid import (pkg.a was) Second test was failing because `foo.py` resolved in two ways, both as `foo` and `foo.foo`. Disambiguating the dir from the file made mypy path work better. The error message was very clear. Came up once foo can be a namespace package.
1 parent df827c9 commit ca24559

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test-data/unit/cmdline.test

+6-6
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ dir/subdir/b.py:1: error: Name "undef" is not defined
7979
[file pkg/__init__.py]
8080
[file pkg/a.py]
8181
undef
82-
import a
82+
import pkg.a
8383
[file pkg/subdir/a.py]
8484
undef
8585
import pkg.a
@@ -306,13 +306,13 @@ mypy.ini: [mypy-*]: Per-module sections should only specify per-module flags (py
306306
[file mypy.ini]
307307
\[mypy]
308308
mypy_path =
309-
foo:bar
310-
, baz
311-
[file foo/foo.pyi]
309+
foo_dir:bar_dir
310+
, baz_dir
311+
[file foo_dir/foo.pyi]
312312
def foo(x: int) -> str: ...
313-
[file bar/bar.pyi]
313+
[file bar_dir/bar.pyi]
314314
def bar(x: str) -> list: ...
315-
[file baz/baz.pyi]
315+
[file baz_dir/baz.pyi]
316316
def baz(x: list) -> dict: ...
317317
[file file.py]
318318
import no_stubs

0 commit comments

Comments
 (0)