@@ -370,26 +370,23 @@ def test_no_warn_with_single_config_file(
370370
371371
372372@pytest .mark .parametrize (
373- "config_file, exception_string " ,
373+ "config_file" ,
374374 [
375- ( ".cz.toml" , r"\.cz\.toml" ) ,
376- ( "cz.toml" , r"cz\.toml" ) ,
377- ( "pyproject.toml" , r"pyproject\.toml" ) ,
375+ ".cz.toml" ,
376+ "cz.toml" ,
377+ "pyproject.toml" ,
378378 ],
379- ids = [".cz.toml" , "cz.toml" , "pyproject.toml" ],
380379)
381380class TestTomlConfig :
382- def test_init_empty_config_content (self , tmpdir , config_file , exception_string ):
381+ def test_init_empty_config_content (self , tmpdir , config_file ):
383382 path = tmpdir .mkdir ("commitizen" ).join (config_file )
384383 toml_config = TomlConfig (data = "" , path = path )
385384 toml_config .init_empty_config_content ()
386385
387386 with open (path , encoding = "utf-8" ) as toml_file :
388387 assert toml_file .read () == "[tool.commitizen]\n "
389388
390- def test_init_empty_config_content_with_existing_content (
391- self , tmpdir , config_file , exception_string
392- ):
389+ def test_init_empty_config_content_with_existing_content (self , tmpdir , config_file ):
393390 existing_content = "[tool.black]\n line-length = 88\n "
394391
395392 path = tmpdir .mkdir ("commitizen" ).join (config_file )
@@ -400,63 +397,60 @@ def test_init_empty_config_content_with_existing_content(
400397 with open (path , encoding = "utf-8" ) as toml_file :
401398 assert toml_file .read () == existing_content + "\n [tool.commitizen]\n "
402399
403- def test_init_with_invalid_config_content (
404- self , tmpdir , config_file , exception_string
405- ):
400+ def test_init_with_invalid_config_content (self , tmpdir , config_file ):
406401 existing_content = "invalid toml content"
407402 path = tmpdir .mkdir ("commitizen" ).join (config_file )
408403
409- with pytest .raises (InvalidConfigurationError , match = exception_string ) :
404+ with pytest .raises (InvalidConfigurationError ) as excinfo :
410405 TomlConfig (data = existing_content , path = path )
406+ assert config_file in str (excinfo .value )
411407
412408
413409@pytest .mark .parametrize (
414- "config_file, exception_string " ,
410+ "config_file" ,
415411 [
416- ( ".cz.json" , r"\.cz\.json" ) ,
417- ( "cz.json" , r"cz\.json" ) ,
412+ ".cz.json" ,
413+ "cz.json" ,
418414 ],
419- ids = [".cz.json" , "cz.json" ],
420415)
421416class TestJsonConfig :
422- def test_init_empty_config_content (self , tmpdir , config_file , exception_string ):
417+ def test_init_empty_config_content (self , tmpdir , config_file ):
423418 path = tmpdir .mkdir ("commitizen" ).join (config_file )
424419 json_config = JsonConfig (data = "{}" , path = path )
425420 json_config .init_empty_config_content ()
426421
427422 with open (path , encoding = "utf-8" ) as json_file :
428423 assert json .load (json_file ) == {"commitizen" : {}}
429424
430- def test_init_with_invalid_config_content (
431- self , tmpdir , config_file , exception_string
432- ):
425+ def test_init_with_invalid_config_content (self , tmpdir , config_file ):
433426 existing_content = "invalid json content"
434427 path = tmpdir .mkdir ("commitizen" ).join (config_file )
435428
436- with pytest .raises (InvalidConfigurationError , match = exception_string ) :
429+ with pytest .raises (InvalidConfigurationError ) as excinfo :
437430 JsonConfig (data = existing_content , path = path )
431+ assert config_file in str (excinfo .value )
438432
439433
440434@pytest .mark .parametrize (
441- "config_file, exception_string " ,
435+ "config_file" ,
442436 [
443- ( ".cz.yaml" , r"\.cz\.yaml" ) ,
444- ( "cz.yaml" , r"cz\.yaml" ) ,
437+ ".cz.yaml" ,
438+ "cz.yaml" ,
445439 ],
446- ids = [".cz.yaml" , "cz.yaml" ],
447440)
448441class TestYamlConfig :
449- def test_init_empty_config_content (self , tmpdir , config_file , exception_string ):
442+ def test_init_empty_config_content (self , tmpdir , config_file ):
450443 path = tmpdir .mkdir ("commitizen" ).join (config_file )
451444 yaml_config = YAMLConfig (data = "{}" , path = path )
452445 yaml_config .init_empty_config_content ()
453446
454447 with open (path ) as yaml_file :
455448 assert yaml .safe_load (yaml_file ) == {"commitizen" : {}}
456449
457- def test_init_with_invalid_content (self , tmpdir , config_file , exception_string ):
450+ def test_init_with_invalid_content (self , tmpdir , config_file ):
458451 existing_content = "invalid: .cz.yaml: content: maybe?"
459452 path = tmpdir .mkdir ("commitizen" ).join (config_file )
460453
461- with pytest .raises (InvalidConfigurationError , match = exception_string ) :
454+ with pytest .raises (InvalidConfigurationError ) as excinfo :
462455 YAMLConfig (data = existing_content , path = path )
456+ assert config_file in str (excinfo .value )
0 commit comments