diff options
| author | Anthony Sottile <asottile@umich.edu> | 2020-01-16 22:59:38 +0000 |
|---|---|---|
| committer | Anthony Sottile <asottile@umich.edu> | 2020-01-16 22:59:38 +0000 |
| commit | d583f051ed8ef047693956670f991692b5749318 (patch) | |
| tree | 599b51792ae0e6797a6aebe2e8d1564c5f2db963 /tests | |
| parent | 6223dd8ab7b268537164cb3d76bec21ea57fefb9 (diff) | |
| parent | bfb79b46c807168dbc25fd1e9e41359c4558256f (diff) | |
| download | flake8-d583f051ed8ef047693956670f991692b5749318.tar.gz | |
Merge branch 'file_not_found_error' into 'master'
Ensure that a not-found file produces an error
Closes #600
See merge request pycqa/flake8!404
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/integration/test_checker.py | 2 | ||||
| -rw-r--r-- | tests/integration/test_main.py | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/tests/integration/test_checker.py b/tests/integration/test_checker.py index 0c14474..93cc239 100644 --- a/tests/integration/test_checker.py +++ b/tests/integration/test_checker.py @@ -216,7 +216,7 @@ def test_report_order(results, expected_order): # Create a placeholder manager without arguments or plugins # Just add one custom file checker which just provides the results manager = checker.Manager(style_guide, [], []) - manager.checkers = [file_checker] + manager.checkers = manager._all_checkers = [file_checker] # _handle_results is the first place which gets the sorted result # Should something non-private be mocked instead? diff --git a/tests/integration/test_main.py b/tests/integration/test_main.py index 9193071..db307ba 100644 --- a/tests/integration/test_main.py +++ b/tests/integration/test_main.py @@ -218,3 +218,12 @@ ignore = F401 py_file.write_text(u"import os\n") _call_main(["--isolated", "--config", str(config), str(py_file)], retv=1) + + +def test_file_not_found(tmpdir, capsys): + """Ensure that a not-found file / directory is an error.""" + with tmpdir.as_cwd(): + _call_main(["i-do-not-exist"], retv=1) + out, err = capsys.readouterr() + assert out.startswith("i-do-not-exist:0:1: E902") + assert err == "" |
