Skip to content

Commit e820cd0

Browse files
committed
Make showcontent default to true in TOML array config
1 parent 322506d commit e820cd0

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

docs/markdown.rst

-6
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,26 @@ Put the following into your ``pyproject.toml`` or ``towncrier.toml``:
2727
[[tool.towncrier.type]]
2828
directory = "security"
2929
name = "Security"
30-
showcontent = true
3130
3231
[[tool.towncrier.type]]
3332
directory = "removed"
3433
name = "Removed"
35-
showcontent = true
3634
3735
[[tool.towncrier.type]]
3836
directory = "deprecated"
3937
name = "Deprecated"
40-
showcontent = true
4138
4239
[[tool.towncrier.type]]
4340
directory = "added"
4441
name = "Added"
45-
showcontent = true
4642
4743
[[tool.towncrier.type]]
4844
directory = "changed"
4945
name = "Changed"
50-
showcontent = true
5146
5247
[[tool.towncrier.type]]
5348
directory = "fixed"
5449
name = "Fixed"
55-
showcontent = true
5650
5751
5852

src/towncrier/_settings/fragment_types.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def load(self) -> Mapping[str, Mapping[str, Any]]:
7878
for type_config in types_config:
7979
directory = type_config["directory"]
8080
fragment_type_name = type_config["name"]
81-
is_content_required = type_config["showcontent"]
81+
is_content_required = type_config.get("showcontent", True)
8282
check = type_config.get("check", True)
8383
types[directory] = {
8484
"name": fragment_type_name,

src/towncrier/test/test_build.py

+23
Original file line numberDiff line numberDiff line change
@@ -1770,3 +1770,26 @@ def test_no_ignore_configured(self, runner):
17701770
_main, ["--draft", "--date", "01-01-2001", "--version", "1.0.0"]
17711771
)
17721772
self.assertEqual(0, result.exit_code, result.output)
1773+
1774+
@with_project(
1775+
config="""
1776+
[tool.towncrier]
1777+
title_format = "{version} - {project_date}"
1778+
1779+
[[tool.towncrier.type]]
1780+
directory = "feature"
1781+
name = "Feature"
1782+
"""
1783+
)
1784+
def test_showcontent_default_toml_array(self, runner):
1785+
"""
1786+
When configuring custom fragment types with a TOML array
1787+
`showcontent` should default to `true`.
1788+
"""
1789+
with open("foo/newsfragments/+new_feature.feature.md", "w") as f:
1790+
f.write("We added an exciting new feature!")
1791+
1792+
result = runner.invoke(
1793+
_main, ["--draft", "--date", "01-01-2001", "--version", "1.0.0"]
1794+
)
1795+
self.assertEqual(0, result.exit_code, result.output)

0 commit comments

Comments
 (0)