mirror of
https://github.com/vale981/releases
synced 2025-03-05 09:41:42 -05:00
Don't asplode when changelogs have no releases.
Test proving #36 and impl fixes #36
This commit is contained in:
parent
01ffe9db4c
commit
f6062b179e
2 changed files with 20 additions and 2 deletions
|
@ -421,11 +421,18 @@ def handle_first_release_line(entries, manager):
|
|||
# It's remotely possible the changelog is totally empty...
|
||||
if not entries:
|
||||
return
|
||||
# Obtain (short-circuiting) first Release obj.
|
||||
first_release = None
|
||||
for obj in entries:
|
||||
if isinstance(obj, Release):
|
||||
first_release = obj
|
||||
break
|
||||
# Here, obj must be the 1st release item. Set it up.
|
||||
manager.add_family(obj.family)
|
||||
# It's also possible it's non-empty but has no releases yet.
|
||||
if first_release:
|
||||
manager.add_family(obj.family)
|
||||
# If God did not exist, man would be forced to invent him.
|
||||
else:
|
||||
manager.add_family(0)
|
||||
|
||||
|
||||
def construct_releases(entries, app):
|
||||
|
|
|
@ -426,6 +426,17 @@ class organization(Spec):
|
|||
}
|
||||
expect_releases(entries, expected)
|
||||
|
||||
def changelogs_without_any_releases_display_unreleased_normally(self):
|
||||
changelog = releases(self.f, self.b, skip_initial=True)
|
||||
# Ensure only the two unreleased 'releases' showed up
|
||||
eq_(len(changelog), 2)
|
||||
# And assert that both items appeared in one of them (since there's no
|
||||
# real releases at all, the bugfixes are treated as 'major' bugs, as
|
||||
# per concepts doc.)
|
||||
bugfix, feature = changelog
|
||||
eq_(len(feature['entries']), 2)
|
||||
eq_(len(bugfix['entries']), 0)
|
||||
|
||||
class unstable_prehistory:
|
||||
def _expect_releases(self, *args, **kwargs):
|
||||
"""
|
||||
|
|
Loading…
Add table
Reference in a new issue