Skip to content

Commit 247826a

Browse files
committed
Add testpep561 test
1 parent 8135bf0 commit 247826a

File tree

14 files changed

+78
-20
lines changed

14 files changed

+78
-20
lines changed

mypy/test/testpep561.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ def install_package(pkg: str,
7979

8080
def test_pep561(testcase: DataDrivenTestCase) -> None:
8181
"""Test running mypy on files that depend on PEP 561 packages."""
82-
if (sys.platform == 'darwin' and hasattr(sys, 'base_prefix') and
83-
sys.base_prefix != sys.prefix):
84-
pytest.skip()
82+
#if (sys.platform == 'darwin' and hasattr(sys, 'base_prefix') and
83+
# sys.base_prefix != sys.prefix):
84+
# pytest.skip()
8585
assert testcase.old_cwd is not None, "test was not properly set up"
8686
if 'python2' in testcase.name.lower():
8787
python = try_find_python2_interpreter()
@@ -141,6 +141,8 @@ def test_pep561(testcase: DataDrivenTestCase) -> None:
141141
iter_count = '' if i == 0 else ' on iteration {}'.format(i + 1)
142142
expected = testcase.output if i == 0 else testcase.output2.get(i + 1, [])
143143

144+
print(venv)
145+
# import pdb ; pdb.set_trace()
144146
assert_string_arrays_equal(expected, output,
145147
'Invalid output ({}, line {}){}'.format(
146148
testcase.file, testcase.line, iter_count))
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
from setuptools import setup, find_packages
1+
from setuptools import setup
22

33
setup(
44
name='typedpkg_namespace.alpha',
55
version='1.0.0',
6-
packages=find_packages(),
76
namespace_packages=['typedpkg_ns'],
87
zip_safe=False,
9-
package_data={'typedpkg_ns.ns': ['py.typed']}
8+
package_data={'typedpkg_ns.a': ['py.typed']},
9+
packages=['typedpkg_ns.a'],
1010
)

test-data/packages/typedpkg_ns/typedpkg_ns/__init__.py renamed to test-data/packages/typedpkg_ns_a/typedpkg_ns/__init__.py

File renamed without changes.

test-data/packages/typedpkg_ns/typedpkg_ns/ns/__init__.py renamed to test-data/packages/typedpkg_ns_a/typedpkg_ns/a/__init__.py

File renamed without changes.
File renamed without changes.

test-data/packages/typedpkg_ns/typedpkg_ns/ns/py.typed renamed to test-data/packages/typedpkg_ns_a/typedpkg_ns/a/py.typed

File renamed without changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
This setup file installs packages to test mypy's PEP 561 implementation
3+
"""
4+
5+
from distutils.core import setup
6+
7+
setup(
8+
name='typedpkg_ns_b-stubs',
9+
author="The mypy team",
10+
version='0.1',
11+
namespace_packages=['typedpkg_ns-stubs'],
12+
package_data={'typedpkg_ns-stubs.b': ['__init__.pyi', 'bbb.pyi']},
13+
packages=['typedpkg_ns-stubs.b'],
14+
)

test-data/packages/typedpkg_ns_b-stubs/typedpkg_ns-stubs/b/__init__.pyi

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def bf(a: bool) -> bool: ...
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from setuptools import setup
2+
3+
setup(
4+
name='typedpkg_namespace.beta',
5+
version='1.0.0',
6+
namespace_packages=['typedpkg_ns'],
7+
zip_safe=False,
8+
package_data={'typedpkg_ns.b': []},
9+
packages=['typedpkg_ns.b'],
10+
)

0 commit comments

Comments
 (0)