File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1251,7 +1251,11 @@ def merge_configuration_file(
12511251
12521252 if "config_file" in flag_args :
12531253 config_file = pathlib .Path (flag_args ["config_file" ]).resolve ()
1254- config = process_config_file (str (config_file ))
1254+ process_method = process_config_file
1255+ if config_file .suffix == ".toml" :
1256+ process_method = process_pyproject_toml
1257+
1258+ config = process_method (str (config_file ))
12551259
12561260 if not config :
12571261 _LOGGER .error (
Original file line number Diff line number Diff line change @@ -3389,6 +3389,28 @@ def test_config_option(self) -> None:
33893389 check = True ,
33903390 )
33913391
3392+ def test_merge_configuration_file__toml_config_option (self ) -> None :
3393+ with temporary_file (
3394+ suffix = ".toml" ,
3395+ contents = ("[tool.autoflake]\n " "check = true\n " ),
3396+ ) as temp_config :
3397+ self .create_file ("test_me.py" )
3398+ files = [self .effective_path ("test_me.py" )]
3399+
3400+ args , success = autoflake .merge_configuration_file (
3401+ {
3402+ "files" : files ,
3403+ "config_file" : temp_config ,
3404+ },
3405+ )
3406+
3407+ assert success is True
3408+ assert args == self .with_defaults (
3409+ files = files ,
3410+ config_file = temp_config ,
3411+ check = True ,
3412+ )
3413+
33923414 def test_load_false (self ) -> None :
33933415 self .create_file ("test_me.py" )
33943416 self .create_file (
You can’t perform that action at this time.
0 commit comments