mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-09 22:34:17 +00:00
Raise exception if append-config does not exist
This commit is contained in:
parent
ad1006e8cb
commit
314b9f5161
2 changed files with 9 additions and 1 deletions
|
|
@ -87,7 +87,10 @@ def load_config(
|
||||||
# TODO: remove this and replace it with configuration modifying plugins
|
# TODO: remove this and replace it with configuration modifying plugins
|
||||||
# read the additional configs afterwards
|
# read the additional configs afterwards
|
||||||
for filename in extra:
|
for filename in extra:
|
||||||
cfg.read(filename, encoding="UTF-8")
|
if not cfg.read(filename, encoding="UTF-8"):
|
||||||
|
raise exceptions.ExecutionError(
|
||||||
|
f"The specified config file does not exist: {filename}"
|
||||||
|
)
|
||||||
|
|
||||||
return cfg, cfg_dir
|
return cfg, cfg_dir
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -222,6 +222,11 @@ def test_load_config_missing_file_raises_exception(capsys):
|
||||||
config.load_config("foo.cfg", [])
|
config.load_config("foo.cfg", [])
|
||||||
|
|
||||||
|
|
||||||
|
def test_load_config_missing_append_config_raise_exception():
|
||||||
|
with pytest.raises(exceptions.ExecutionError):
|
||||||
|
config.load_config(None, ["dont_exist_config.cfg"], isolated=False)
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_ignore_codes_raise_error(tmpdir, opt_manager):
|
def test_invalid_ignore_codes_raise_error(tmpdir, opt_manager):
|
||||||
tmpdir.join("setup.cfg").write("[flake8]\nignore = E203, //comment")
|
tmpdir.join("setup.cfg").write("[flake8]\nignore = E203, //comment")
|
||||||
with tmpdir.as_cwd():
|
with tmpdir.as_cwd():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue