A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/openstack/reno/commit/081a4145e18c82acba877ee22c180b3428c773f6 below:

make sections configurable · openstack/reno@081a414 · GitHub

File tree Expand file treeCollapse file tree 7 files changed

+111

-37

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+111

-37

lines changed Original file line number Diff line number Diff line change

@@ -50,13 +50,16 @@ Editing a Release Note

50 50

======================

51 51 52 52

The note file is a YAML file with several sections. All of the text is

53 -

interpreted as having `reStructuredText`_ formatting.

53 +

interpreted as having `reStructuredText`_ formatting. The permitted

54 +

sections are configurable (see below) but default to the following

55 +

list:

54 56 55 57

prelude

56 58 57 59

General comments about the release. The prelude from all notes in a

58 60

section are combined, in note order, to produce a single prelude

59 -

introducing that release.

61 +

introducing that release. This section is always included, regardless

62 +

of what sections are configured.

60 63 61 64

features

62 65

@@ -177,6 +180,14 @@ may be the most convenient way to manage the values consistently.

177 180

earliest_version: 12.0.0

178 181

collapse_pre_releases: false

179 182

stop_at_branch_base: true

183 +

sections:

184 +

# The prelude section is implicitly included.

185 +

- [features, New Features]

186 +

- [issues, Known Issues]

187 +

- [upgrade, Upgrade Notes]

188 +

- [api, API Changes]

189 +

- [security, Security Issues]

190 +

- [fixes, Bug Fixes]

180 191

template: |

181 192

<template-used-to-create-new-notes>

182 193

...

Original file line number Diff line number Diff line change

@@ -0,0 +1,7 @@

1 +

---

2 +

features:

3 +

- |

4 +

Add a configuration option ``sections`` to hold the list of

5 +

permitted section identifiers and corresponding display names.

6 +

This also determines the order in which sections are collated.

7 + Original file line number Diff line number Diff line change

@@ -140,6 +140,20 @@ class Config(object):

140 140

# scanning history to determine where to stop, to find the

141 141

# "base" of a branch. Other branches are ignored.

142 142

'branch_name_re': 'stable/.+',

143 + 144 +

# The identifiers and names of permitted sections in the

145 +

# release notes, in the order in which the final report will

146 +

# be generated.

147 +

'sections': [

148 +

['features', 'New Features'],

149 +

['issues', 'Known Issues'],

150 +

['upgrade', 'Upgrade Notes'],

151 +

['deprecations', 'Deprecation Notes'],

152 +

['critical', 'Critical Issues'],

153 +

['security', 'Security Issues'],

154 +

['fixes', 'Bug Fixes'],

155 +

['other', 'Other Notes'],

156 +

],

143 157

}

144 158 145 159

@classmethod

Original file line number Diff line number Diff line change

@@ -13,18 +13,6 @@

13 13

from __future__ import print_function

14 14 15 15 16 -

_SECTION_ORDER = [

17 -

('features', 'New Features'),

18 -

('issues', 'Known Issues'),

19 -

('upgrade', 'Upgrade Notes'),

20 -

('deprecations', 'Deprecation Notes'),

21 -

('critical', 'Critical Issues'),

22 -

('security', 'Security Issues'),

23 -

('fixes', 'Bug Fixes'),

24 -

('other', 'Other Notes'),

25 -

]

26 - 27 - 28 16

def _indent_for_list(text, prefix=' '):

29 17

"""Indent some text to make it work as a list entry.

30 18

@@ -37,7 +25,7 @@ def _indent_for_list(text, prefix=' '):

37 25

]) + '\n'

38 26 39 27 40 -

def format_report(loader, versions_to_include, title=None):

28 +

def format_report(loader, config, versions_to_include, title=None):

41 29

report = []

42 30

if title:

43 31

report.append('=' * len(title))

@@ -64,7 +52,7 @@ def format_report(loader, versions_to_include, title=None):

64 52

report.append(file_contents[n]['prelude'])

65 53

report.append('')

66 54 67 -

for section_name, section_title in _SECTION_ORDER:

55 +

for section_name, section_title in config.sections:

68 56

notes = [

69 57

n

70 58

for fn, sha in notefiles

Original file line number Diff line number Diff line change

@@ -25,6 +25,7 @@ def report_cmd(args, conf):

25 25

versions = ldr.versions

26 26

text = formatter.format_report(

27 27

ldr,

28 +

conf,

28 29

versions,

29 30

title='Release Notes',

30 31

)

Original file line number Diff line number Diff line change

@@ -90,6 +90,7 @@ def info(msg):

90 90

info('got versions %s' % (versions,))

91 91

text = formatter.format_report(

92 92

ldr,

93 +

conf,

93 94

versions,

94 95

title=title,

95 96

)

Original file line number Diff line number Diff line change

@@ -20,7 +20,7 @@

20 20

from reno.tests import base

21 21 22 22 23 -

class TestFormatter(base.TestCase):

23 +

class TestFormatterBase(base.TestCase):

24 24 25 25

scanner_output = {

26 26

'0.0.0': [('note1', 'shaA')],

@@ -29,29 +29,11 @@ class TestFormatter(base.TestCase):

29 29 30 30

versions = ['0.0.0', '1.0.0']

31 31 32 -

note_bodies = {

33 -

'note1': {

34 -

'prelude': 'This is the prelude.',

35 -

},

36 -

'note2': {

37 -

'issues': [

38 -

'This is the first issue.',

39 -

'This is the second issue.',

40 -

],

41 -

},

42 -

'note3': {

43 -

'features': [

44 -

'We added a feature!',

45 -

],

46 -

'upgrade': None,

47 -

},

48 -

}

49 - 50 32

def _get_note_body(self, reporoot, filename, sha):

51 33

return self.note_bodies.get(filename, '')

52 34 53 35

def setUp(self):

54 -

super(TestFormatter, self).setUp()

36 +

super(TestFormatterBase, self).setUp()

55 37 56 38

def _load(ldr):

57 39

ldr._scanner_output = self.scanner_output

@@ -67,9 +49,31 @@ def _load(ldr):

67 49

ignore_cache=False,

68 50

)

69 51 52 + 53 +

class TestFormatter(TestFormatterBase):

54 + 55 +

note_bodies = {

56 +

'note1': {

57 +

'prelude': 'This is the prelude.',

58 +

},

59 +

'note2': {

60 +

'issues': [

61 +

'This is the first issue.',

62 +

'This is the second issue.',

63 +

],

64 +

},

65 +

'note3': {

66 +

'features': [

67 +

'We added a feature!',

68 +

],

69 +

'upgrade': None,

70 +

},

71 +

}

72 + 70 73

def test_with_title(self):

71 74

result = formatter.format_report(

72 75

loader=self.ldr,

76 +

config=self.c,

73 77

versions_to_include=self.versions,

74 78

title='This is the title',

75 79

)

@@ -78,6 +82,7 @@ def test_with_title(self):

78 82

def test_versions(self):

79 83

result = formatter.format_report(

80 84

loader=self.ldr,

85 +

config=self.c,

81 86

versions_to_include=self.versions,

82 87

title='This is the title',

83 88

)

@@ -87,14 +92,16 @@ def test_versions(self):

87 92

def test_without_title(self):

88 93

result = formatter.format_report(

89 94

loader=self.ldr,

95 +

config=self.c,

90 96

versions_to_include=self.versions,

91 97

title=None,

92 98

)

93 99

self.assertNotIn('This is the title', result)

94 100 95 -

def test_section_order(self):

101 +

def test_default_section_order(self):

96 102

result = formatter.format_report(

97 103

loader=self.ldr,

104 +

config=self.c,

98 105

versions_to_include=self.versions,

99 106

title=None,

100 107

)

@@ -104,3 +111,48 @@ def test_section_order(self):

104 111

expected = [prelude_pos, features_pos, issues_pos]

105 112

actual = list(sorted([prelude_pos, features_pos, issues_pos]))

106 113

self.assertEqual(expected, actual)

114 + 115 + 116 +

class TestFormatterCustomSections(TestFormatterBase):

117 +

note_bodies = {

118 +

'note1': {

119 +

'prelude': 'This is the prelude.',

120 +

},

121 +

'note2': {

122 +

'features': [

123 +

'This is the first feature.',

124 +

],

125 +

'api': [

126 +

'This is the API change for the first feature.',

127 +

],

128 +

},

129 +

'note3': {

130 +

'api': [

131 +

'This is the API change for the second feature.',

132 +

],

133 +

'features': [

134 +

'This is the second feature.',

135 +

],

136 +

},

137 +

}

138 + 139 +

def setUp(self):

140 +

super(TestFormatterCustomSections, self).setUp()

141 +

self.c.override(sections=[

142 +

['api', 'API Changes'],

143 +

['features', 'New Features'],

144 +

])

145 + 146 +

def test_custom_section_order(self):

147 +

result = formatter.format_report(

148 +

loader=self.ldr,

149 +

config=self.c,

150 +

versions_to_include=self.versions,

151 +

title=None,

152 +

)

153 +

prelude_pos = result.index('This is the prelude.')

154 +

api_pos = result.index('API Changes')

155 +

features_pos = result.index('New Features')

156 +

expected = [prelude_pos, api_pos, features_pos]

157 +

actual = list(sorted([prelude_pos, features_pos, api_pos]))

158 +

self.assertEqual(expected, actual)

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4