diff --git a/releases/__init__.py b/releases/__init__.py index 7e71158..d589b54 100644 --- a/releases/__init__.py +++ b/releases/__init__.py @@ -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): diff --git a/tests/organization.py b/tests/organization.py index c5d104f..003febc 100644 --- a/tests/organization.py +++ b/tests/organization.py @@ -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): """