def explicit_releases_error_on_unfound_issues(self): # Just a release - result will have 1.0.0, 1.0.1, and unreleased changelog = release_list('1.0.1') # No issues listed -> this clearly doesn't exist in any buckets changelog[1][0].append(Text("25")) # This should asplode construct_releases(changelog, make_app())
def un_prefixed_list_items_get_no_prefix_under_unstable_prehistory(self): app = make_app(unstable_prehistory=True) fake = list_item('', paragraph('', '', raw('', 'whatever'))) node = self._generate('0.1.0', fake, app=app, skip_initial=True) # [<raw bug text>] eq_(len(node[0]), 1) assert 'Bug' not in str(node[0][0]) assert 'whatever' in str(node[0][0])
def un_prefixed_list_items_get_no_prefix_under_unstable_prehistory(self): app = make_app(unstable_prehistory=True) fake = list_item("", paragraph("", "", raw("", "whatever"))) node = self._generate("0.1.0", fake, app=app, skip_initial=True) # [<raw bug text>] assert len(node[0]) == 1 assert "Bug" not in str(node[0][0]) assert "whatever" in str(node[0][0])
def un_prefixed_list_items_get_no_prefix_under_unstable_prehistory(self): app = make_app(unstable_prehistory=True) fake = list_item('', paragraph('', '', raw('', 'whatever'))) node = self._generate('0.1.0', fake, app=app, skip_initial=True) # [<raw bug text>] eq_(len(node[0]), 1) assert 'Bug' not in str(node[0][0]) assert 'whatever' in str(node[0][0])
def explicit_bugfix_releases_get_removed_from_unreleased(self): b1 = b(1) b2 = b(2) changelog = release_list('1.0.1', b1, b2) # Ensure that 1.0.1 specifies bug 2 changelog[0][0].append(Text('2')) rendered, _ = construct_releases(changelog, make_app()) # 1.0.1 should have bug 2 only assert b2 in rendered[1]['entries'] assert b1 not in rendered[1]['entries'] # unreleased bug list should still get/see bug 1 assert b1 in rendered[2]['entries']
def explicit_feature_release_features_are_removed_from_unreleased(self): f1 = f(1) f2 = f(2) changelog = release_list('1.1.0', f1, f2) # Ensure that 1.1.0 specifies feature 2 changelog[0][0].append(Text("2")) rendered = changelog2dict(construct_releases(changelog, make_app())[0]) # 1.1.0 should have feature 2 only assert f2 in rendered['1.1.0'] assert f1 not in rendered['1.1.0'] # unreleased feature list should still get/see feature 1 assert f1 in rendered['unreleased_1.x_feature'] # now-released feature 2 should not be in unreleased_feature assert f2 not in rendered['unreleased_1.x_feature']
def _test_link(self, kwargs, type_, expected): app = make_app(**kwargs) nodes = construct_nodes(construct_releases([ release('1.0.2', app=app), entry(b(15, app=app)), release('1.0.0'), ], app=app)) if type_ == 'release': header = nodes[0][0][0].astext() assert expected in header elif type_ == 'issue': link = nodes[0][1][0][0][2] eq_(link['refuri'], expected) else: raise Exception("Gave unknown type_ kwarg to _test_link()!")
def _test_link(self, kwargs, type_, expected): app = make_app(**kwargs) nodes = construct_nodes( construct_releases([ release('1.0.2', app=app), entry(b(15, app=app)), release('1.0.0'), ], app=app)) if type_ == 'release': header = nodes[0][0][0].astext() assert expected in header elif type_ == 'issue': link = nodes[0][1][0][0][2] eq_(link['refuri'], expected) else: raise Exception("Gave unknown type_ kwarg to _test_link()!")
def releases_can_specify_issues_explicitly(self): # Build regular list-o-entries b2 = b(2) b3 = b(3) changelog = release_list('1.0.1', '1.1.1', b3, b2, self.b, '1.1.0', self.f) # Modify 1.0.1 release to be speshul changelog[0][0].append(Text("2, 3")) rendered = construct_releases(changelog, make_app()) # 1.0.1 includes just 2 and 3, not bug 1 one_0_1 = rendered[3]['entries'] one_1_1 = rendered[2]['entries'] assert self.b not in one_0_1 assert b2 in one_0_1 assert b3 in one_0_1 # 1.1.1 includes all 3 (i.e. the explicitness of 1.0.1 didn't affect # the 1.1 line bucket.) assert self.b in one_1_1 assert b2 in one_1_1 assert b3 in one_1_1
def releases_can_specify_issues_explicitly(self): # Build regular list-o-entries b2 = b(2) b3 = b(3) changelog = release_list( '1.0.1', '1.1.1', b3, b2, self.b, '1.1.0', self.f ) # Modify 1.0.1 release to be speshul changelog[0][0].append(Text("2, 3")) rendered, _ = construct_releases(changelog, make_app()) # 1.0.1 includes just 2 and 3, not bug 1 one_0_1 = rendered[3]['entries'] one_1_1 = rendered[2]['entries'] assert self.b not in one_0_1 assert b2 in one_0_1 assert b3 in one_0_1 # 1.1.1 includes all 3 (i.e. the explicitness of 1.0.1 didn't affect # the 1.1 line bucket.) assert self.b in one_1_1 assert b2 in one_1_1 assert b3 in one_1_1
def _test_link(self, kwargs, type_, expected): app = make_app(**kwargs) nodes = construct_nodes( construct_releases( [ release("1.0.2", app=app), entry(b(15, app=app)), release("1.0.0"), ], app=app, )[0]) # Shorthand for "I'll do my own asserts" if expected is None: return nodes if type_ == "release": header = nodes[0][0][0].astext() assert expected in header elif type_ == "issue": link = nodes[0][1][0][0][2] assert link["refuri"] == expected else: raise Exception("Gave unknown type_ kwarg to _test_link()!")
def unstable_prehistory_active_means_only_one_unreleased_release(self): app = make_app(unstable_prehistory=True) entries = (b(2), f(3), '0.1.0', b(1)) result = self._generate(*entries, app=app, raw=True, skip_initial=True) html = str(result[0][0][0]) assert "Next release" in html
def _expect_releases(self, *args, **kwargs): """ expect_releases() wrapper setting unstable_prehistory by default """ kwargs['app'] = make_app(unstable_prehistory=True) return expect_releases(*args, **kwargs)
def explicit_release_list_split_works_with_unicode(self): changelog = release_list('1.0.1', b(17)) changelog[0][0].append(Text(six.text_type('17'))) # When using naive method calls, this explodes construct_releases(changelog, make_app())
def unstable_prehistory_active_means_only_one_unreleased_release(self): app = make_app(unstable_prehistory=True) entries = (b(2), f(3), "0.1.0", b(1)) result = self._generate(*entries, app=app, raw=True, skip_initial=True) html = str(result[0][0][0]) assert "Next release" in html