1313
1414CONFIG1 = """\
1515 [scriv]
16- output_file = README.md
16+ changelog = README.md
1717categories = New, Different, Gone, Bad
1818"""
1919
20+ OLD_CONFIG1 = CONFIG1 .replace ("changelog = " , "output_file = " )
21+
2022CONFIG2 = """\
2123 [someotherthing]
2224no_idea = what this is
2325
2426[tool.scriv]
25- output_file = README.md
27+ changelog = README.md
2628categories =
2729 New
2830 Different
5961 GENERIC_TOML_CONFIG
6062 + """
6163[tool.scriv]
62- output_file = "README.md"
64+ changelog = "README.md"
6365categories = [
6466 "New",
6567 "Different",
7375"""
7476)
7577
78+ OLD_TOML_CONFIG = TOML_CONFIG .replace ("changelog = " , "output_file = " )
79+
7680
7781def test_defaults (temp_dir ):
7882 # No configuration files anywhere, just get all the defaults.
@@ -90,7 +94,7 @@ def test_defaults(temp_dir):
9094 "Fixed" ,
9195 "Security" ,
9296 ]
93- assert config .output_file == "CHANGELOG.rst"
97+ assert config .changelog == "CHANGELOG.rst"
9498 assert config .insert_marker == "scriv-insert-here"
9599 assert config .rst_header_chars == "=-"
96100 assert config .md_header_level == "1"
@@ -100,11 +104,12 @@ def test_defaults(temp_dir):
100104 assert config .version == ""
101105
102106
103- def test_reading_config (temp_dir ):
104- (temp_dir / "setup.cfg" ).write_text (CONFIG1 )
107+ @pytest .mark .parametrize ("config_text" , [CONFIG1 , OLD_CONFIG1 ])
108+ def test_reading_config (config_text , temp_dir ):
109+ (temp_dir / "setup.cfg" ).write_text (config_text )
105110 config = Config .read ()
106111 assert config .fragment_directory == "changelog.d"
107- assert config .output_file == "README.md"
112+ assert config .changelog == "README.md"
108113 assert config .categories == ["New" , "Different" , "Gone" , "Bad" ]
109114
110115
@@ -227,7 +232,7 @@ def test_override_default_name(changelog_d):
227232def test_file_reading (changelog_d ):
228233 # Any setting can be read from a file, even where it doesn't make sense.
229234 (changelog_d / "hello.txt" ).write_text ("Xyzzy" )
230- text = Config (output_file = "file:hello.txt" ).output_file
235+ text = Config (changelog = "file:hello.txt" ).changelog
231236 assert text == "Xyzzy"
232237
233238
@@ -301,7 +306,7 @@ def test_rst_chars_is_two_chars(chars):
301306def test_md_format (changelog_d ):
302307 (changelog_d / "scriv.ini" ).write_text ("[scriv]\n format = md\n " )
303308 config = Config .read ()
304- assert config .output_file == "CHANGELOG.md"
309+ assert config .changelog == "CHANGELOG.md"
305310 template = re .sub (r"\s+" , " " , config .new_fragment_template )
306311 assert template .startswith ("<!-- A new scriv changelog fragment." )
307312
@@ -312,9 +317,11 @@ class TestTomlConfig:
312317 """
313318
314319 @pytest .mark .skipif (tomllib is None , reason = "No TOML support installed" )
315- def test_reading_toml_file (self , temp_dir ):
316- (temp_dir / "pyproject.toml" ).write_text (TOML_CONFIG )
320+ @pytest .mark .parametrize ("config_text" , [TOML_CONFIG , OLD_TOML_CONFIG ])
321+ def test_reading_toml_file (self , config_text , temp_dir ):
322+ (temp_dir / "pyproject.toml" ).write_text (config_text )
317323 config = Config .read ()
324+ assert config .changelog == "README.md"
318325 assert config .categories == ["New" , "Different" , "Gone" , "Bad" ]
319326
320327 def test_toml_without_us (self , temp_dir ):
@@ -371,12 +378,12 @@ def test_command_running(mocker, cmd_output, result):
371378 mocker .patch (
372379 "scriv.config.run_shell_command" , lambda cmd : (True , cmd_output )
373380 )
374- text = Config (output_file = "command: doesnt-matter" ).output_file
381+ text = Config (changelog = "command: doesnt-matter" ).changelog
375382 assert text == result
376383
377384
378385def test_real_command_running ():
379- text = Config (output_file = "command: echo Xyzzy 2 3" ).output_file
386+ text = Config (changelog = "command: echo Xyzzy 2 3" ).changelog
380387 assert text == "Xyzzy 2 3"
381388
382389
@@ -385,15 +392,15 @@ def test_real_command_running():
385392 [
386393 (
387394 "xyzzyplugh" ,
388- "Couldn't read 'output_file ' setting: Command 'xyzzyplugh' failed:" ,
395+ "Couldn't read 'changelog ' setting: Command 'xyzzyplugh' failed:" ,
389396 ),
390397 (
391398 "'hi!2><" ,
392- "Couldn't read 'output_file ' setting: Command \" 'hi!2><\" failed:" ,
399+ "Couldn't read 'changelog ' setting: Command \" 'hi!2><\" failed:" ,
393400 ),
394401 ],
395402)
396403def test_bad_command (fake_run_command , bad_cmd , msg_rx ):
397404 # Any setting can be the output of a command.
398405 with pytest .raises (ScrivException , match = msg_rx ):
399- _ = Config (output_file = f"command: { bad_cmd } " ).output_file
406+ _ = Config (changelog = f"command: { bad_cmd } " ).changelog
0 commit comments