summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2021-04-18 10:04:13 -0700
committerAnthony Sottile <asottile@umich.edu>2021-04-18 10:08:11 -0700
commit456e98486ecb912aba01f31859c5f74a5a4d3f81 (patch)
tree2a2b60b425910a94366088a31187a371047c55b6 /tests/unit
parent645cd71f571da1cdc42683cf4228b537ddc2685f (diff)
downloadflake8-456e98486ecb912aba01f31859c5f74a5a4d3f81.tar.gz
short circuit on ast error before tokenization error
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_exceptions.py1
-rw-r--r--tests/unit/test_file_checker.py24
2 files changed, 0 insertions, 25 deletions
diff --git a/tests/unit/test_exceptions.py b/tests/unit/test_exceptions.py
index e9be495..6be1ebd 100644
--- a/tests/unit/test_exceptions.py
+++ b/tests/unit/test_exceptions.py
@@ -13,7 +13,6 @@ from flake8 import exceptions
plugin_name="plugin_name",
exception=ValueError("boom!"),
),
- exceptions.InvalidSyntax(exception=ValueError("Unexpected token: $")),
exceptions.PluginRequestedUnknownParameters(
plugin={"plugin_name": "plugin_name"},
exception=ValueError("boom!"),
diff --git a/tests/unit/test_file_checker.py b/tests/unit/test_file_checker.py
index f433ea6..bcc8b32 100644
--- a/tests/unit/test_file_checker.py
+++ b/tests/unit/test_file_checker.py
@@ -7,30 +7,6 @@ import flake8
from flake8 import checker
-@mock.patch("flake8.processor.FileProcessor")
-def test_run_ast_checks_handles_SyntaxErrors(FileProcessor): # noqa: N802,N803
- """Stress our SyntaxError handling.
-
- Related to: https://github.com/pycqa/flake8/issues/169
- """
- processor = mock.Mock(lines=[])
- FileProcessor.return_value = processor
- processor.build_ast.side_effect = SyntaxError(
- "Failed to build ast", ("", 1, 5, "foo(\n")
- )
- file_checker = checker.FileChecker(__file__, checks={}, options=object())
-
- with mock.patch.object(file_checker, "report") as report:
- file_checker.run_ast_checks()
-
- report.assert_called_once_with(
- "E999",
- 1,
- 3,
- "SyntaxError: Failed to build ast",
- )
-
-
@mock.patch("flake8.checker.FileChecker._make_processor", return_value=None)
def test_repr(*args):
"""Verify we generate a correct repr."""