python-kacl 0.5.0__tar.gz → 0.5.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {python_kacl-0.5.0/python_kacl.egg-info → python_kacl-0.5.1}/PKG-INFO +1 -1
  2. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/__init__.py +1 -1
  3. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/document.py +10 -3
  4. {python_kacl-0.5.0 → python_kacl-0.5.1/python_kacl.egg-info}/PKG-INFO +1 -1
  5. {python_kacl-0.5.0 → python_kacl-0.5.1}/setup.py +1 -1
  6. {python_kacl-0.5.0 → python_kacl-0.5.1}/tests/test_cli.py +122 -0
  7. {python_kacl-0.5.0 → python_kacl-0.5.1}/LICENSE +0 -0
  8. {python_kacl-0.5.0 → python_kacl-0.5.1}/MANIFEST.in +0 -0
  9. {python_kacl-0.5.0 → python_kacl-0.5.1}/README.md +0 -0
  10. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/__main__.py +0 -0
  11. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/changes.py +0 -0
  12. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/config/kacl-default.yml +0 -0
  13. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/config.py +0 -0
  14. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/element.py +0 -0
  15. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/exception.py +0 -0
  16. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/kacl_cli.py +0 -0
  17. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/link_provider.py +0 -0
  18. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/parser.py +0 -0
  19. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/serializer.py +0 -0
  20. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/validation.py +0 -0
  21. {python_kacl-0.5.0 → python_kacl-0.5.1}/kacl/version.py +0 -0
  22. {python_kacl-0.5.0 → python_kacl-0.5.1}/python_kacl.egg-info/SOURCES.txt +0 -0
  23. {python_kacl-0.5.0 → python_kacl-0.5.1}/python_kacl.egg-info/dependency_links.txt +0 -0
  24. {python_kacl-0.5.0 → python_kacl-0.5.1}/python_kacl.egg-info/entry_points.txt +0 -0
  25. {python_kacl-0.5.0 → python_kacl-0.5.1}/python_kacl.egg-info/not-zip-safe +0 -0
  26. {python_kacl-0.5.0 → python_kacl-0.5.1}/python_kacl.egg-info/requires.txt +0 -0
  27. {python_kacl-0.5.0 → python_kacl-0.5.1}/python_kacl.egg-info/top_level.txt +0 -0
  28. {python_kacl-0.5.0 → python_kacl-0.5.1}/setup.cfg +0 -0
  29. {python_kacl-0.5.0 → python_kacl-0.5.1}/tests/__init__.py +0 -0
  30. {python_kacl-0.5.0 → python_kacl-0.5.1}/tests/snapshot_directory.py +0 -0
  31. {python_kacl-0.5.0 → python_kacl-0.5.1}/tests/test_kacl.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-kacl
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Python module and CLI tool for validating and modifying Changelogs in "keep-a-changelog" format"
5
5
  Home-page: https://gitlab.com/schmieder.matthias/python-kacl.git
6
6
  Author: Matthias Schmieder
@@ -1,5 +1,5 @@
1
1
  # Version of the python-kacl package
2
- __version__ = "0.5.0"
2
+ __version__ = "0.5.1"
3
3
 
4
4
  from kacl.document import KACLDocument
5
5
  from kacl.serializer import KACLMarkdownSerializer
@@ -293,10 +293,17 @@ class KACLDocument:
293
293
  ):
294
294
  comp_result = future_version.compare(last_version)
295
295
  # 2.3 if 'last version' was NOT a 'post version' ensure 'post version' has same 'base version'
296
- elif future_version_base != last_version_base:
297
- comp_result = -1 # indicate error
298
296
  else:
299
- comp_result = 1
297
+ comp_result = future_version_base.compare(last_version_base)
298
+ # 2.4 if 'last version' has same 'base version' as 'future version' this is ok, because we
299
+ # define post version as 'higher' than base version
300
+ if comp_result == 0:
301
+ comp_result = 1
302
+ elif (
303
+ last_version.prerelease
304
+ and post_release_version_prefix in last_version.prerelease
305
+ ):
306
+ comp_result = future_version_base.compare(last_version_base)
300
307
  else:
301
308
  comp_result = future_version.compare(last_version)
302
309
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-kacl
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Python module and CLI tool for validating and modifying Changelogs in "keep-a-changelog" format"
5
5
  Home-page: https://gitlab.com/schmieder.matthias/python-kacl.git
6
6
  Author: Matthias Schmieder
@@ -11,7 +11,7 @@ this_directory = path.abspath(path.dirname(__file__))
11
11
  with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
12
12
  long_description = f.read()
13
13
 
14
- version = "0.5.0"
14
+ version = "0.5.1"
15
15
 
16
16
  version = f"{version}{os.environ.get('PIP_VERSION_POSTFIX', '')}"
17
17
 
@@ -95,6 +95,128 @@ def test_release_patch(tmp_path, snapshot):
95
95
  snapshot_directory(snapshot=snapshot, directory_path=project_root_path)
96
96
 
97
97
 
98
+ @freeze_time("2023-01-01")
99
+ def test_release_post_bump(tmp_path, snapshot):
100
+ runner = CliRunner()
101
+ resources_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data/")
102
+ changelog_file = os.path.join(resources_dir, "CHANGELOG_with_changes.md")
103
+
104
+ with runner.isolated_filesystem(temp_dir=tmp_path) as project_root_path:
105
+ shutil.copyfile(changelog_file, os.path.join(project_root_path, "CHANGELOG.md"))
106
+ result = runner.invoke(
107
+ cli,
108
+ [
109
+ "-c",
110
+ os.path.join(resources_dir, "extension-config.yml"),
111
+ "-f",
112
+ "CHANGELOG.md",
113
+ "release",
114
+ "post",
115
+ "-m",
116
+ ],
117
+ catch_exceptions=False,
118
+ )
119
+ assert result.exit_code == 0, result.output
120
+ snapshot_directory(snapshot=snapshot, directory_path=project_root_path)
121
+
122
+
123
+ @freeze_time("2023-01-01")
124
+ def test_release_post_manual(tmp_path, snapshot):
125
+ runner = CliRunner()
126
+ resources_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data/")
127
+ changelog_file = os.path.join(resources_dir, "CHANGELOG_with_changes.md")
128
+
129
+ with runner.isolated_filesystem(temp_dir=tmp_path) as project_root_path:
130
+ shutil.copyfile(changelog_file, os.path.join(project_root_path, "CHANGELOG.md"))
131
+ result = runner.invoke(
132
+ cli,
133
+ [
134
+ "-c",
135
+ os.path.join(resources_dir, "extension-config.yml"),
136
+ "-f",
137
+ "CHANGELOG.md",
138
+ "release",
139
+ "2.0.0-hotfix.0",
140
+ "-m",
141
+ ],
142
+ catch_exceptions=False,
143
+ )
144
+ assert result.exit_code == 0, result.output
145
+ snapshot_directory(snapshot=snapshot, directory_path=project_root_path)
146
+
147
+
148
+ @freeze_time("2023-01-01")
149
+ def test_release_post_manual_fail(tmp_path, snapshot):
150
+ runner = CliRunner()
151
+ resources_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data/")
152
+ changelog_file = os.path.join(resources_dir, "CHANGELOG_with_changes.md")
153
+
154
+ with runner.isolated_filesystem(temp_dir=tmp_path) as project_root_path:
155
+ shutil.copyfile(changelog_file, os.path.join(project_root_path, "CHANGELOG.md"))
156
+ result = runner.invoke(
157
+ cli,
158
+ [
159
+ "-c",
160
+ os.path.join(resources_dir, "extension-config.yml"),
161
+ "-f",
162
+ "CHANGELOG.md",
163
+ "release",
164
+ "0.5.0-hotfix.0",
165
+ "-m",
166
+ ],
167
+ catch_exceptions=True,
168
+ )
169
+ assert result.exit_code == 1, result.output
170
+
171
+
172
+ @freeze_time("2023-01-01")
173
+ def test_release_version_manual_fail_same_base_after_post(tmp_path, snapshot):
174
+ runner = CliRunner()
175
+ resources_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data/")
176
+ changelog_file = os.path.join(resources_dir, "CHANGELOG_post_with_changes.md")
177
+
178
+ with runner.isolated_filesystem(temp_dir=tmp_path) as project_root_path:
179
+ shutil.copyfile(changelog_file, os.path.join(project_root_path, "CHANGELOG.md"))
180
+ result = runner.invoke(
181
+ cli,
182
+ [
183
+ "-c",
184
+ os.path.join(resources_dir, "extension-config.yml"),
185
+ "-f",
186
+ "CHANGELOG.md",
187
+ "release",
188
+ "1.0.0",
189
+ "-m",
190
+ ],
191
+ catch_exceptions=True,
192
+ )
193
+ assert result.exit_code == 1, result.output
194
+
195
+
196
+ @freeze_time("2023-01-01")
197
+ def test_release_post_manual_same_base(tmp_path, snapshot):
198
+ runner = CliRunner()
199
+ resources_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data/")
200
+ changelog_file = os.path.join(resources_dir, "CHANGELOG_with_changes.md")
201
+
202
+ with runner.isolated_filesystem(temp_dir=tmp_path) as project_root_path:
203
+ shutil.copyfile(changelog_file, os.path.join(project_root_path, "CHANGELOG.md"))
204
+ result = runner.invoke(
205
+ cli,
206
+ [
207
+ "-c",
208
+ os.path.join(resources_dir, "extension-config.yml"),
209
+ "-f",
210
+ "CHANGELOG.md",
211
+ "release",
212
+ "1.0.0-post.0",
213
+ "-m",
214
+ ],
215
+ catch_exceptions=False,
216
+ )
217
+ assert result.exit_code == 0, result.output
218
+
219
+
98
220
  @freeze_time("2023-01-01")
99
221
  def test_release_minor(tmp_path, snapshot):
100
222
  runner = CliRunner()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes