Test when tokenize raises a SyntaxError.
(tmpdir, capsys)
| 179 | |
| 180 | |
| 181 | def test_tokenization_error_is_a_syntax_error(tmpdir, capsys): |
| 182 | """Test when tokenize raises a SyntaxError.""" |
| 183 | with tmpdir.as_cwd(): |
| 184 | tmpdir.join("t.py").write("if True:\n pass\n pass\n") |
| 185 | assert cli.main(["t.py"]) == 1 |
| 186 | |
| 187 | if sys.implementation.name == "pypy": # pragma: no cover (pypy) |
| 188 | expected = "t.py:3:3: E999 IndentationError: unindent does not match any outer indentation level\n" # noqa: E501 |
| 189 | else: # pragma: no cover (cp310+) |
| 190 | expected = "t.py:3:7: E999 IndentationError: unindent does not match any outer indentation level\n" # noqa: E501 |
| 191 | |
| 192 | out, err = capsys.readouterr() |
| 193 | assert out == expected |
| 194 | assert err == "" |
| 195 | |
| 196 | |
| 197 | def test_bug_report_successful(capsys): |