Skip to content

Instantly share code, notes, and snippets.

@dmoisset
Created April 10, 2018 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmoisset/785428692cfc3a969bce71dc826572b7 to your computer and use it in GitHub Desktop.
Save dmoisset/785428692cfc3a969bce71dc826572b7 to your computer and use it in GitHub Desktop.
test failure mypy af7e834
====================================================== FAILURES =======================================================
______________________________________________ TestPEP561.test_typed_pkg ______________________________________________
[gw1] linux -- Python 3.6.2 /home/machinalis/.virtualenvs/mypy-dev/bin/python3
self = <mypy.test.testpep561.TestPEP561 testMethod=test_typed_pkg>
def test_typed_pkg(self) -> None:
"""Tests type checking based on installed packages.
This test CANNOT be split up, concurrency means that simultaneously
installing/uninstalling will break tests.
"""
test_file = 'simple.py'
if not os.path.isdir('test-packages-data'):
os.mkdir('test-packages-data')
old_cwd = os.getcwd()
os.chdir('test-packages-data')
with open(test_file, 'w') as f:
f.write(SIMPLE_PROGRAM)
try:
with self.install_package('typedpkg-stubs'):
check_mypy_run(
[test_file],
"simple.py:4: error: Revealed type is 'builtins.list[builtins.str]'\n"
)
# The Python 2 tests are intentionally placed after a Python 3 test to check
# the package_dir_cache is behaving correctly.
python2 = try_find_python2_interpreter()
if python2:
with self.install_package('typedpkg-stubs', python2):
check_mypy_run(
['--python-executable={}'.format(python2), test_file],
"simple.py:4: error: Revealed type is 'builtins.list[builtins.str]'\n"
)
with self.install_package('typedpkg', python2):
check_mypy_run(
['--python-executable={}'.format(python2), 'simple.py'],
"simple.py:4: error: Revealed type is 'builtins.tuple[builtins.str]'\n"
)
with self.install_package('typedpkg', python2):
with self.install_package('typedpkg-stubs', python2):
check_mypy_run(
['--python-executable={}'.format(python2), test_file],
"simple.py:4: error: Revealed type is 'builtins.list[builtins.str]'\n"
)
with self.install_package('typedpkg'):
check_mypy_run(
[test_file],
> "simple.py:4: error: Revealed type is 'builtins.tuple[builtins.str]'\n"
)
mypy/test/testpep561.py:103:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmd_line = ['simple.py'], expected_out = "simple.py:4: error: Revealed type is 'builtins.tuple[builtins.str]'\n"
expected_err = '', expected_returncode = 1
def check_mypy_run(cmd_line: List[str],
expected_out: str,
expected_err: str = '',
expected_returncode: int = 1) -> None:
"""Helper to run mypy and check the output."""
out, err, returncode = mypy.api.run(cmd_line)
> assert out == expected_out, err
E AssertionError:
E assert "simple.py:4:...ltins.str]'\n" == "simple.py:4: ...ltins.str]'\n"
E Skipping 37 identical leading characters in diff, use -v to show
E - 'builtins.list[builtins.str]'
E ? ^^^
E + 'builtins.tuple[builtins.str]'
E ? +++ ^
mypy/test/testpep561.py:27: AssertionError
============================================== 1 failed in 26.85 seconds ==============================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment