Validate that mypy correctly infers the return-types of the expressions in `path`.
(path: str)
| 163 | @pytest.mark.skipif(NO_MYPY, reason="Mypy is not installed") |
| 164 | @pytest.mark.parametrize("path", get_test_cases(REVEAL_DIR)) |
| 165 | def test_reveal(path: str) -> None: |
| 166 | """Validate that mypy correctly infers the return-types of |
| 167 | the expressions in `path`. |
| 168 | """ |
| 169 | __tracebackhide__ = True |
| 170 | |
| 171 | output_mypy = OUTPUT_MYPY |
| 172 | if path not in output_mypy: |
| 173 | return |
| 174 | |
| 175 | relpath = os.path.relpath(path) |
| 176 | |
| 177 | # collect any reported errors, and clean up the output |
| 178 | failures = [] |
| 179 | for error_line in output_mypy[path]: |
| 180 | lineno, error_msg = _strip_filename(error_line) |
| 181 | error_msg = textwrap.indent(error_msg, _FAIL_INDENT) |
| 182 | reason = _FAIL_MSG_REVEAL.format(relpath, lineno, error_msg) |
| 183 | failures.append(reason) |
| 184 | |
| 185 | if failures: |
| 186 | reasons = _FAIL_SEP.join(failures) |
| 187 | pytest.fail(reasons, pytrace=False) |
| 188 | |
| 189 | |
| 190 | @pytest.mark.filterwarnings("ignore::DeprecationWarning") |
nothing calls this directly
no test coverage detected
searching dependent graphs…