mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-29 10:36:53 +00:00
add check for a missing specified config file
This commit is contained in:
parent
d478d92299
commit
d948169292
2 changed files with 6 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ from typing import List
|
|||
from typing import Optional
|
||||
from typing import Tuple
|
||||
|
||||
from flake8 import exceptions
|
||||
from flake8.options.manager import OptionManager
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
@ -60,7 +61,10 @@ def load_config(
|
|||
|
||||
cfg = configparser.RawConfigParser()
|
||||
if config is not None:
|
||||
cfg.read(config)
|
||||
if not cfg.read(config):
|
||||
raise exceptions.ExecutionError(
|
||||
f"The specified config file does not exist: {config}"
|
||||
)
|
||||
cfg_dir = os.path.dirname(config)
|
||||
else:
|
||||
cfg_dir = pwd
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ def test_config_file_not_found(tmpdir, capsys):
|
|||
|
||||
expected = """\
|
||||
There was a critical error during execution of Flake8:
|
||||
The specified config file does not exist
|
||||
The specified config file does not exist: missing.cfg
|
||||
"""
|
||||
|
||||
with tmpdir.as_cwd():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue