def specs_and_keywords_play_together_nicely(self): b1 = b(1) b2 = b(2, major=True, spec='1.0+') f3 = f(3) # Feature copied to both 1.x and 2.x branches f4 = f(4, spec='1.0+') # Support item backported to bugfix line + 1.17 + 2.0.0 s5 = s(5, spec='1.0+', backported=True) entries = ( '2.0.0', '1.17.0', '1.16.1', s5, f4, f3, b2, b1, '1.16.0', ) expected = { '1.16.1': [b1, s5], # s5 backported ok '1.17.0': [b2, f4, s5], # s5 here too, plus major bug b2 '2.0.0': [b2, f3, f4, s5], # all featurelike items here } expect_releases(entries, expected)
def bugs_before_major_releases_associate_with_previous_release_only(self): b1 = b(1) b2 = b(2) f3 = f(3) f4 = f(4) f5 = f(5, spec="<2.0") b6 = b(6) entries = ( '2.0.0', '1.2.0', '1.1.1', b6, f5, f4, '1.1.0', '1.0.1', f3, b2, b1, ) expected = { '2.0.0': [f4], # but not f5 '1.2.0': [f5], # but not f4 '1.1.1': [b6], '1.1.0': [f3], '1.0.1': [b1, b2] } expect_releases(entries, expected)
def plus_annotations_let_old_lines_continue_getting_released(self): b9 = b(9) f8 = f(8) f7 = f(7, spec="1.0+") b6 = b(6, spec="1.0+") f5 = f(5) f4 = f(4) f3 = f(3) b2 = b(2) b1 = b(1) entries = ( '2.1.0', '2.0.1', '1.2.0', '1.1.1', '1.0.2', b9, f8, f7, b6, '2.0.0', f5, f4, '1.1.0', '1.0.1', f3, b2, b1, ) expected = { '2.1.0': [f7, f8], '2.0.1': [b6, b9], '1.2.0': [f7], # but not f8 '1.1.1': [b6], # but not b9 '1.0.2': [b6], # but not b9 '2.0.0': [f4, f5], '1.1.0': [f3], '1.0.1': [b1, b2], } expect_releases(entries, expected)
def backported_features_also_appear_in_feature_releases(self): entries = ( '1.1.0', '1.0.2', self.bf, self.b, self.s, ) # Ensure bf (backported feature) is in BOTH 1.0.2 AND 1.1.0 expected = { '1.0.2': [self.bf, self.b], '1.1.0': [self.bf, self.s], } expect_releases(entries, expected)
def features_before_first_release_function_correctly(self): f0 = f(0) b1 = b(1) f2 = f(2) entries = ('0.2.0', f2, '0.1.1', b1, '0.1.0', f0) expected = { '0.1.0': [f0], '0.1.1': [b1], '0.2.0': [f2], } # Make sure to skip typically-implicit 1.0.0 release. # TODO: consider removing that entirely; arguably needing it is a bug? expect_releases(entries, expected, skip_initial=True)
def features_before_first_release_function_correctly(self): f0 = f(0) b1 = b(1) f2 = f(2) entries = ( '0.2.0', f2, '0.1.1', b1, '0.1.0', f0 ) expected = { '0.1.0': [f0], '0.1.1': [b1], '0.2.0': [f2], } # Make sure to skip typically-implicit 1.0.0 release. # TODO: consider removing that entirely; arguably needing it is a bug? expect_releases(entries, expected, skip_initial=True)
def rolling_release_works_without_annotation(self): b1 = b(1) b2 = b(2) f3 = f(3) f4 = f(4) f5 = f(5) b6 = b(6) f7 = f(7) entries = ('2.1.0', '2.0.1', f7, b6, '2.0.0', f5, f4, '1.1.0', '1.0.1', f3, b2, b1) expected = { '1.0.1': [b1, b2], '1.1.0': [f3], '2.0.0': [f4, f5], '2.0.1': [b6], '2.1.0': [f7], } expect_releases(entries, expected)
def semver_spec_annotations_allow_preventing_forward_porting(self): f9 = f(9, spec=">=1.0") f8 = f(8) b7 = b(7, spec="<2.0") b6 = b(6, spec="1.0+") f5 = f(5) f4 = f(4) f3 = f(3) b2 = b(2) b1 = b(1) entries = ( '2.1.0', '2.0.1', '1.2.0', '1.1.1', '1.0.2', f9, f8, b7, b6, '2.0.0', f5, f4, '1.1.0', '1.0.1', f3, b2, b1, ) expected = { '2.1.0': [f8, f9], '2.0.1': [b6], # (but not #7) '1.2.0': [f9], # (but not #8) '1.1.1': [b6, b7], '1.0.2': [b6, b7], '2.0.0': [f4, f5], '1.1.0': [f3], '1.0.1': [b1, b2], } expect_releases(entries, expected)
def rolling_release_works_without_annotation(self): b1 = b(1) b2 = b(2) f3 = f(3) f4 = f(4) f5 = f(5) b6 = b(6) f7 = f(7) entries = ( '2.1.0', '2.0.1', f7, b6, '2.0.0', f5, f4, '1.1.0', '1.0.1', f3, b2, b1 ) expected = { '1.0.1': [b1, b2], '1.1.0': [f3], '2.0.0': [f4, f5], '2.0.1': [b6], '2.1.0': [f7], } expect_releases(entries, expected)
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)