@@ -171,10 +171,23 @@ def ask_run_end_to_end_test(args: Namespace) -> None:
171171 run_end_to_end_test (args , file_path )
172172
173173
174- def is_valid_pyproject_toml (pyproject_toml_path : Path ) -> tuple [bool , dict [str , Any ] | None , str ]: # noqa: PLR0911
174+ def config_found (pyproject_toml_path : Union [str , Path ]) -> tuple [bool , str ]:
175+ pyproject_toml_path = Path (pyproject_toml_path )
176+
175177 if not pyproject_toml_path .exists ():
176- return False , None , f"Configuration file not found: { pyproject_toml_path } "
178+ return False , f"Configuration file not found: { pyproject_toml_path } "
179+
180+ if not pyproject_toml_path .is_file ():
181+ return False , f"Configuration file is not a file: { pyproject_toml_path } "
182+
183+ if pyproject_toml_path .suffix != ".toml" :
184+ return False , f"Configuration file is not a .toml file: { pyproject_toml_path } "
185+
186+ return True , ""
177187
188+
189+ def is_valid_pyproject_toml (pyproject_toml_path : Union [str , Path ]) -> tuple [bool , dict [str , Any ] | None , str ]:
190+ pyproject_toml_path = Path (pyproject_toml_path )
178191 try :
179192 config , _ = parse_config_file (pyproject_toml_path )
180193 except Exception as e :
@@ -206,6 +219,10 @@ def should_modify_pyproject_toml() -> tuple[bool, dict[str, Any] | None]:
206219
207220 pyproject_toml_path = Path .cwd () / "pyproject.toml"
208221
222+ found , _ = config_found (pyproject_toml_path )
223+ if not found :
224+ return True , None
225+
209226 valid , config , _message = is_valid_pyproject_toml (pyproject_toml_path )
210227 if not valid :
211228 # needs to be re-configured
0 commit comments