diff --git a/tests/test_mypy.yml b/tests/test_mypy.yml index f65e58efd..70a89670f 100644 --- a/tests/test_mypy.yml +++ b/tests/test_mypy.yml @@ -766,6 +766,7 @@ return 'hello' - case: testAttrsUsingBadConverter + regex: true main: | import attr from typing import overload @@ -785,13 +786,14 @@ bad_overloaded: int = attr.ib(converter=bad_overloaded_converter) reveal_type(A) out: | - main:15: error: Cannot determine __init__ type from converter [misc] - main:15: error: Argument "converter" has incompatible type "Callable[[], str]"; expected "Callable[[Any], Any] | None" [arg-type] - main:16: error: Cannot determine __init__ type from converter [misc] - main:16: error: Argument "converter" has incompatible type overloaded function; expected "Callable[[Any], Any] | None" [arg-type] - main:17: note: Revealed type is "def (bad: Any, bad_overloaded: Any) -> main.A" + main:15: error: Cannot determine __init__ type from converter \[misc\] + main:15: error: Argument "converter" has incompatible type \"Callable\[\[\], str\]\"; expected (\"Callable\[\[Any\], Any\] \| None\"|\"Optional\[Callable\[\[Any\], Any\]\]\") \[arg-type\] + main:16: error: Cannot determine __init__ type from converter \[misc\] + main:16: error: Argument "converter" has incompatible type overloaded function; expected (\"Callable\[\[Any\], Any\] \| None\"|\"Optional\[Callable\[\[Any\], Any\]\]\") \[arg-type\] + main:17: note: Revealed type is "def (bad: Any, bad_overloaded: Any\) -> main.A" - case: testAttrsUsingBadConverterReprocess + regex: true main: | import attr from typing import overload @@ -812,11 +814,11 @@ bad_overloaded: int = attr.ib(converter=bad_overloaded_converter) reveal_type(A) out: | - main:16: error: Cannot determine __init__ type from converter [misc] - main:16: error: Argument "converter" has incompatible type "Callable[[], str]"; expected "Callable[[Any], Any] | None" [arg-type] - main:17: error: Cannot determine __init__ type from converter [misc] - main:17: error: Argument "converter" has incompatible type overloaded function; expected "Callable[[Any], Any] | None" [arg-type] - main:18: note: Revealed type is "def (bad: Any, bad_overloaded: Any) -> main.A" + main:16: error: Cannot determine __init__ type from converter \[misc\] + main:16: error: Argument \"converter\" has incompatible type \"Callable\[\[\], str\]\"; expected (\"Callable\[\[Any\], Any\] \| None\"|\"Optional\[Callable\[\[Any\], Any\]\]\") \[arg-type\] + main:17: error: Cannot determine __init__ type from converter \[misc\] + main:17: error: Argument "converter" has incompatible type overloaded function; expected (\"Callable\[\[Any\], Any\] \| None\"|\"Optional\[Callable\[\[Any\], Any\]\]\") \[arg-type\] + main:18: note: Revealed type is "def (bad: Any, bad_overloaded: Any\) -> main.A" - case: testAttrsUsingUnsupportedConverter main: | diff --git a/tox.ini b/tox.ini index 9c4c1983f..ef24c03ad 100644 --- a/tox.ini +++ b/tox.ini @@ -23,14 +23,11 @@ pass_env = NO_COLOR extras = tests: tests -deps = - mypy: attrs[tests-mypy] + mypy: tests-mypy commands = tests: pytest {posargs:-n auto} mypy: mypy tests/typing_example.py mypy: mypy src/attrs/__init__.pyi src/attr/__init__.pyi src/attr/_typing_compat.pyi src/attr/_version_info.pyi src/attr/converters.pyi src/attr/exceptions.pyi src/attr/filters.pyi src/attr/setters.pyi src/attr/validators.pyi -allowlist_externals = - mypy [testenv:py3{7,10,11}-tests] extras = cov