11"""Tests for tools/next_version.py -- the release policy itself.
22
33The policy is ordinary semver with the bump derived from the batch: the second
4- component moves only for features, `dev ` cuts release candidates for the
4+ component moves only for features, `nightly ` cuts release candidates for the
55version the batch is heading toward, and `main` cuts the final of that same
66target.
77
4343 ("v2.20.0+g1234567" , None ),
4444 ("2.20.0" , None ),
4545 ("v2.20" , None ),
46- ("dev " , None ),
46+ ("nightly " , None ),
4747 ],
4848)
4949def test_only_released_versions_are_baseline_candidates (tag , expected ):
@@ -69,7 +69,7 @@ def test_latest_final_compares_numerically_not_lexically():
6969
7070def test_no_tags_at_all_starts_from_zero ():
7171 assert latest_final ([]) == (0 , 0 , 0 )
72- assert latest_final (["dev " , "some-marker" ]) == (0 , 0 , 0 )
72+ assert latest_final (["nightly " , "some-marker" ]) == (0 , 0 , 0 )
7373
7474
7575# --- feature detection ------------------------------------------------------
@@ -148,7 +148,7 @@ def test_an_empty_batch_has_no_target():
148148 than invent a version."""
149149 assert target_version ((2 , 20 , 0 ), []) is None
150150 assert compute ("stable" , ["v2.20.0" ], []) is None
151- assert compute ("dev " , ["v2.20.0" ], []) is None
151+ assert compute ("nightly " , ["v2.20.0" ], []) is None
152152
153153
154154# --- candidate numbering ----------------------------------------------------
@@ -180,14 +180,14 @@ def test_candidate_numbering_survives_a_deleted_tag():
180180# --- the two channels, and the ordering that motivates the whole design -----
181181
182182
183- def test_dev_cuts_a_candidate_for_the_next_version ():
183+ def test_nightly_cuts_a_candidate_for_the_next_version ():
184184 tags = ["v2.20.0" ]
185- assert compute ("dev " , tags , ["fix: a" ]) == "v2.20.1rc1"
186- assert compute ("dev " , tags , ["feat: a" ]) == "v2.21.0rc1"
185+ assert compute ("nightly " , tags , ["fix: a" ]) == "v2.20.1rc1"
186+ assert compute ("nightly " , tags , ["feat: a" ]) == "v2.21.0rc1"
187187
188188
189189def test_main_cuts_the_final_of_the_same_target ():
190- """Merging dev down promotes the candidate rather than inventing a
190+ """Merging nightly down promotes the candidate rather than inventing a
191191 different number: the fix-only cycle above ends at 2.20.1, not 2.21.0."""
192192 tags = ["v2.20.0" , "v2.20.1rc1" , "v2.20.1rc2" ]
193193 assert compute ("stable" , tags , ["fix: a" ]) == "v2.20.1"
@@ -201,9 +201,9 @@ def test_candidates_sort_above_the_previous_release_and_below_their_own():
201201 it becomes. Asserted end to end across a whole fix-only cycle.
202202 """
203203 shipped = parse ("2.20.0" )
204- rc1 = parse (compute ("dev " , ["v2.20.0" ], ["fix: a" ]).lstrip ("v" ))
204+ rc1 = parse (compute ("nightly " , ["v2.20.0" ], ["fix: a" ]).lstrip ("v" ))
205205 rc2 = parse (
206- compute ("dev " , ["v2.20.0" , "v2.20.1rc1" ], ["fix: a" , "fix: b" ]).lstrip ("v" )
206+ compute ("nightly " , ["v2.20.0" , "v2.20.1rc1" ], ["fix: a" , "fix: b" ]).lstrip ("v" )
207207 )
208208 final = parse (
209209 compute ("stable" , ["v2.20.0" , "v2.20.1rc1" , "v2.20.1rc2" ], ["fix: a" ]).lstrip (
@@ -220,7 +220,7 @@ def test_a_feature_cycle_also_orders_correctly_against_the_fix_cycle():
220220 """2.20.1 < 2.21.0rc1 < 2.21.0 -- a candidate for the next minor must not
221221 look older than the patch release that preceded it."""
222222 patch_release = parse ("2.20.1" )
223- rc = parse (compute ("dev " , ["v2.20.1" ], ["feat: a" ]).lstrip ("v" ))
223+ rc = parse (compute ("nightly " , ["v2.20.1" ], ["feat: a" ]).lstrip ("v" ))
224224 final = parse (compute ("stable" , ["v2.20.1" , "v2.21.0rc1" ], ["feat: a" ]).lstrip ("v" ))
225225 assert patch_release < rc < final
226226
@@ -301,9 +301,9 @@ def test_commit_messages_since_baseline_excludes_the_baseline_itself(tmp_path):
301301
302302
303303def test_baseline_need_not_be_reachable_from_head (tmp_path ):
304- """main's release tag can sit on a commit dev does not contain.
304+ """main's release tag can sit on a commit nightly does not contain.
305305
306- A reachability-restricted baseline would compute the next dev from a
306+ A reachability-restricted baseline would compute the next nightly from a
307307 stale release and hand out a version below what already shipped.
308308 """
309309 repo = tmp_path / "repo"
@@ -320,24 +320,24 @@ def test_baseline_need_not_be_reachable_from_head(tmp_path):
320320 _git ("commit" , "-qm" , "fix: released on main" , cwd = repo )
321321 _git ("tag" , "v2.20.1" , cwd = repo )
322322
323- _git ("checkout" , "-q" , "-b" , "dev " , "v2.20.0" , cwd = repo )
324- (repo / "f.txt" ).write_text ("dev \n " )
323+ _git ("checkout" , "-q" , "-b" , "nightly " , "v2.20.0" , cwd = repo )
324+ (repo / "f.txt" ).write_text ("nightly \n " )
325325 _git ("add" , "-A" , cwd = repo )
326- _git ("commit" , "-qm" , "fix: on the dev branch" , cwd = repo )
326+ _git ("commit" , "-qm" , "fix: on the nightly branch" , cwd = repo )
327327
328328 tags = [t for t in _git ("tag" , cwd = repo ).splitlines () if t .strip ()]
329329 assert latest_final (tags ) == (2 , 20 , 1 ), "baseline must see main's release tag"
330330
331331 messages = commit_messages (str (repo ), (2 , 20 , 1 ))
332- got = compute ("dev " , tags , messages )
332+ got = compute ("nightly " , tags , messages )
333333 assert got == "v2.20.2rc1" , (
334- f"the next dev must sort above the release that already shipped, got { got } "
334+ f"the next nightly must sort above the release that already shipped, got { got } "
335335 )
336336 assert parse ("2.20.1" ) < parse (got .lstrip ("v" ))
337337
338338
339- def test_main_prints_candidate_for_dev (tmp_path , capsys ):
340- """main(["--channel", "dev ", "--repo-dir", str(repo)]) returns 0 and
339+ def test_main_prints_candidate_for_nightly (tmp_path , capsys ):
340+ """main(["--channel", "nightly ", "--repo-dir", str(repo)]) returns 0 and
341341 prints a candidate tag matching ^v\\ d+\\ .\\ d+\\ .\\ d+rc\\ d+$."""
342342 repo = tmp_path / "repo"
343343 repo .mkdir ()
@@ -348,10 +348,10 @@ def test_main_prints_candidate_for_dev(tmp_path, capsys):
348348
349349 from tools .next_version import main
350350
351- result = main (["--channel" , "dev " , "--repo-dir" , str (repo )])
351+ result = main (["--channel" , "nightly " , "--repo-dir" , str (repo )])
352352 assert result == 0
353353 captured = capsys .readouterr ()
354- assert captured .out .strip (), "dev must print a tag"
354+ assert captured .out .strip (), "nightly must print a tag"
355355 assert captured .out .strip ().startswith ("v" )
356356 # Verify format: v0.0.1rc1
357357 import re
@@ -429,4 +429,4 @@ def test_a_repository_with_no_tags_cuts_the_first_patch():
429429def test_a_first_batch_containing_a_feature_cuts_the_first_minor ():
430430 """The whole history is one batch on the first run, so a single `feat`
431431 anywhere in it takes the first release to 0.1.0 rather than 0.0.1."""
432- assert compute ("dev " , [], ["fix: a" , "feat: b" , "docs: c" ]) == "v0.1.0rc1"
432+ assert compute ("nightly " , [], ["fix: a" , "feat: b" , "docs: c" ]) == "v0.1.0rc1"
0 commit comments