You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2026/10/21 14:54:17 UTC
(juneau) branch master updated: Draw a one-block in-flight bar for a running single-module build, keep the Overall line while test.py owns the terminal, and rename the push rows to Java tests and Python tests
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new e286ee72fa Draw a one-block in-flight bar for a running single-module build, keep the Overall line while test.py owns the terminal, and rename the push rows to Java tests and Python tests
e286ee72fa is described below
commit e286ee72fa294a0274fe8ea354901513820b0114
Author: James Bognar <ja...@apache.org>
AuthorDate: Wed Oct 21 10:42:53 2026 -0400
Draw a one-block in-flight bar for a running single-module build, keep the Overall line while test.py owns the terminal, and rename the push rows to Java tests and Python tests
---
juneau-run/README.md | 1 +
juneau-run/src/main/python/juneau_run.py | 68 ++++++++++++++++++++-----
juneau-run/src/test/python/support.py | 2 +-
juneau-run/src/test/python/test_render.py | 33 ++++++++++--
juneau-run/src/test/python/test_runner.py | 7 +++
juneau-run/src/test/python/test_session_plan.py | 37 ++++++++++++++
scripts/push.py | 12 ++---
scripts/test.py | 22 ++++----
scripts/tests/README.md | 2 +-
scripts/tests/conftest.py | 2 +-
scripts/tests/test_run_adoption.py | 22 ++++----
scripts/tests/test_script_tests_step.py | 8 +--
scripts/tests/test_test_py_history.py | 2 +-
scripts/tests/test_test_py_run_command.py | 2 +-
14 files changed, 167 insertions(+), 53 deletions(-)
diff --git a/juneau-run/README.md b/juneau-run/README.md
index 046a8c5502..c9e3a82394 100644
--- a/juneau-run/README.md
+++ b/juneau-run/README.md
@@ -96,6 +96,7 @@ off a terminal (`TERM=dumb` and `JUNEAU_RUN_LIVE=0` count as off) it prints the
| `JUNEAU_RUN_LIVE=0` | Plain view: each row printed once, when it ends. Also used when stdout isn't a terminal or `TERM=dumb`. |
| `NO_COLOR` | The live view without colour. |
| `JUNEAU_RUN_LABEL_WIDTH` | Minimum width of the row labels (default 10). A parent sets it for a nested script so the rows line up. |
+| `JUNEAU_RUN_PENDING`, `JUNEAU_RUN_OVERALL` | Set by a parent for a nested script: the parent's pending rows, and its elapsed time, done steps and pending steps. With the second, the nested view keeps drawing the whole run's Overall line; without it a nested view draws none. |
| `JUNEAU_RUN_HISTORY=0` | Turns off recording and estimating run history (default on). Without history the view shows no percent, time estimates or Overall line. |
| `JUNEAU_RUN_HISTORY_DIR` | Replaces `~/.cache/juneau-run/history`, where per-repository run history is kept. The tests point it at a temp dir. |
| `JUNEAU_RUN_HISTORY_KEY` | Replaces the per-repository key under that directory (`<name>-<hash>` of the git common dir, which linked worktrees already share), so separate clones of one repository can share one history. Made file-name safe. |
diff --git a/juneau-run/src/main/python/juneau_run.py b/juneau-run/src/main/python/juneau_run.py
index a4931acc72..2220bc1bcd 100644
--- a/juneau-run/src/main/python/juneau_run.py
+++ b/juneau-run/src/main/python/juneau_run.py
@@ -532,6 +532,7 @@ _MARK_COLORS = {"✓": "\x1b[32m✓\x1b[0m", "✗": "\x1b[31m✗\x1b[0m"}
_MARK_RE = re.compile("(?<!m)[✓✗]") # not one already coloured (right after an SGR escape)
_NOTE_PREFIX = {"info": "ℹ", "warn": "⚠", "error": "✗"}
PENDING_ENV = "JUNEAU_RUN_PENDING" # a parent session's labelled pending rows, [[id, label], ...], for a nested one
+OVERALL_ENV = "JUNEAU_RUN_OVERALL" # a parent session's {elapsed, done, pending: [[id, hist_wall_s], ...]}, for a nested one
# A row's icon (spec 5.2): a spinner while it runs, then its outcome: a coloured ● for ok, warn and fail, or ✔ ⚠ ✗
# when colour is off. No VS16 after ⚠: it must stay one column.
SPINNER = "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏"
@@ -879,6 +880,18 @@ def _parent_pending():
return []
+def _parent_overall():
+ """JUNEAU_RUN_OVERALL as (elapsed, done, [(id, hist_wall_s or None)]), or None when it is unset or malformed."""
+ try:
+ value = json.loads(os.environ.get(OVERALL_ENV) or "null")
+ if value is None:
+ return None
+ pending = [(str(i), None if hist is None else float(hist)) for i, hist in value["pending"]]
+ return float(value["elapsed"]), int(value["done"]), pending
+ except (ValueError, TypeError, KeyError):
+ return None
+
+
class Board:
"""The run's state for the console view. apply(kind, fields) returns the blocks that event produces."""
@@ -898,6 +911,7 @@ class Board:
self.plan = None # the planned top-level step ids, in order (spec 6), or None
self.plan_labels = {} # planned step id -> label, for the ones that draw a pending row
self.parent_pending = _parent_pending() if nested else [] # a parent session's pending rows, (id, label)
+ self.parent_overall = _parent_overall() if nested else None # a parent session's Overall inputs (OVERALL_ENV)
self.finished = False # the done event arrived: nothing is pending any more
self.shown_end = None # the Overall figure's projected end (session seconds) last displayed, held by damp_total
self.plan_estimates = {} # planned step id -> history wall_s or None, asked of the estimator once per plan
@@ -1039,14 +1053,16 @@ class Board:
self.plan_estimates[step_id] = est.wall_s if est else None
return self.plan_estimates[step_id]
- def overall(self):
- """The whole-run Overall figure, or None: no plan, a nested session, or nothing known (spec 6.2, 6.3)."""
- if not self.plan or self.nested:
- return None
- # Parallel planned steps each add their remaining time, so a plan that runs steps concurrently is an overestimate.
- now = self.clock()
- last_started = max((i for i, sid in enumerate(self.plan) if sid in self.rows), default=-1)
+ def _overall_steps(self, now):
+ """The plan's steps as overall_figures() takes them, after a parent session's (OVERALL_ENV): its done steps,
+ and its pending ones that this plan and these rows do not already cover."""
steps = []
+ if self.parent_overall is not None:
+ _, done, pending = self.parent_overall
+ steps = [("", "done", None, None)] * done
+ steps += [(sid, "pending", hist, None) for sid, hist in pending
+ if sid not in (self.plan or ()) and sid not in self.rows]
+ last_started = max((i for i, sid in enumerate(self.plan) if sid in self.rows), default=-1)
for i, sid in enumerate(self.plan):
r = self.rows.get(sid)
if r is None:
@@ -1063,14 +1079,37 @@ class Board:
(total, e) if total is not None else None))
elif r.status != "skip":
steps.append((sid, "done", None, None))
- o = overall_figures(now - self.session_t0, steps)
+ return steps
+
+ def _overall_elapsed(self, now):
+ return now - self.session_t0 + (self.parent_overall[0] if self.parent_overall is not None else 0)
+
+ def overall(self):
+ """The whole-run Overall figure, or None: no plan, a nested session without its parent's (OVERALL_ENV), or
+ nothing known (spec 6.2, 6.3)."""
+ if not self.plan or (self.nested and self.parent_overall is None):
+ return None
+ # Parallel planned steps each add their remaining time, so a plan that runs steps concurrently is an overestimate.
+ now = self.clock()
+ elapsed = self._overall_elapsed(now)
+ o = overall_figures(elapsed, self._overall_steps(now))
if o is None or o.remaining <= 0:
return o
- elapsed = now - self.session_t0 # damp the projected end like a row's total, then show what is left of it
+ # damp the projected end like a row's total, then show what is left of it
self.shown_end = damp_total(self.shown_end, elapsed + o.remaining, elapsed, rounded=False)
left = max(self.shown_end - elapsed, 0)
return o._replace(remaining=round_estimate(left) if left > 0 else left)
+ def overall_handoff(self):
+ """What a child session needs to carry on the Overall figure (OVERALL_ENV), or None with no plan: the seconds
+ elapsed, the steps done, and the steps still pending with their history, as [id, wall_s or None]."""
+ if not self.plan:
+ return None
+ now = self.clock()
+ steps = self._overall_steps(now)
+ return {"elapsed": self._overall_elapsed(now), "done": sum(1 for _, state, _, _ in steps if state == "done"),
+ "pending": [[sid, hist] for sid, state, hist, _ in steps if state == "pending"]}
+
def _on_step_start(self, f):
parent = self.rows.get(f.get("parent"))
if parent is not None: # a sub-row: a box on its parent's row until its tool sends modules (_adopt)
@@ -1527,12 +1566,12 @@ def row_text(row, glyphs, now, pending=False):
# show on a finished row whose units did not all report.
unreported = not row.running and row.unit_kind == "modules" and not row.units_done
# A finished module bar that never counted a unit (a -q build sends no module events) shows no bar at all.
- # A running reactor of one barred module has nothing to count: its one cell would sit at 0/1 until the end, so
- # the row shows the test count and a percent from the tests run against history's expected count instead.
+ # A running reactor of one barred module has nothing to count (no module-start event): it shows one in-flight
+ # cell and no 0/1, and the percent comes from the tests run against history's expected count instead.
single = row.running and row.unit_kind == "modules" and row.units_total + row.units_dropped == 1 \
and not row.units_done
if single:
- cells = None
+ cells = [glyphs["run"]]
elif not unreported and (row.bar_units or row.size or row.units_total or row.unit_kind == "modules"):
if row.unit_kind:
cells = unit_bar(row.unit_view(), row.units_total, glyphs)
@@ -2423,7 +2462,7 @@ def passthrough(cmd, step_id, title, *, n=None, parent=None, cwd=None, env=None,
def handoff():
"""Give the terminal to a child session (push.py running test.py) for the block. Yields the env the child needs
so its rows line up with ours (label width, detail level) and our pending rows stay visible under its own
- (JUNEAU_RUN_PENDING); empty with no session."""
+ (JUNEAU_RUN_PENDING) and its Overall line carries on (JUNEAU_RUN_OVERALL); empty with no session."""
if _console is None:
yield {}
return
@@ -2431,6 +2470,9 @@ def handoff():
pending = list(_console.board.pending())
if pending:
env[PENDING_ENV] = json.dumps([[i, label] for i, label in pending])
+ overall = _console.board.overall_handoff()
+ if overall:
+ env[OVERALL_ENV] = json.dumps(overall)
with _paused():
yield env
diff --git a/juneau-run/src/test/python/support.py b/juneau-run/src/test/python/support.py
index 66f475dac9..e97681ba92 100644
--- a/juneau-run/src/test/python/support.py
+++ b/juneau-run/src/test/python/support.py
@@ -53,7 +53,7 @@ def reset_run_state():
jr._console = None
for key in (jr.ACTIVE_ENV, "JUNEAU_RUN_FULL_LOG", "JUNEAU_RUN_SESSION", "JUNEAU_RUN_DETAIL", "JUNEAU_RUN_LABEL_WIDTH",
"JUNEAU_RUN_LIVE", "JUNEAU_RUN_CONSOLE", "RUN_MARKERS", "JUNEAU_RUN_CONDENSED_LOG",
- "JUNEAU_RUN_PENDING"):
+ "JUNEAU_RUN_PENDING", "JUNEAU_RUN_OVERALL"):
os.environ.pop(key, None)
diff --git a/juneau-run/src/test/python/test_render.py b/juneau-run/src/test/python/test_render.py
index b836bdcbd4..6cf563dd83 100644
--- a/juneau-run/src/test/python/test_render.py
+++ b/juneau-run/src/test/python/test_render.py
@@ -469,6 +469,13 @@ class OverallDisplayTest(unittest.TestCase):
for b in (self.board(plan=None), self.board(hist={}), self.board(nested=True)):
self.assertTrue(self.live().region(b, 79, 18)[0][2:].startswith("A"))
+ def test_nested_board_with_a_parent_overall_ends_on_the_overall_line(self):
+ env = {"JUNEAU_RUN_OVERALL": json.dumps({"elapsed": 30, "done": 1, "pending": [["install", 60.0]]})}
+ with mock.patch.dict(os.environ, env):
+ b = self.board(nested=True)
+ lines = self.live().region(b, 79, 18)
+ self.assertEqual(lines[-1], "Overall 28% ~2:30 left · 1 of 4 steps") # 60 / (60 + 150): a and b + install, 30s + 30s of parent time
+
def test_setup_row_sits_above_the_overall_line(self):
b = self.board()
b.apply("reactor", dict(step="a", size=5, poms=["p0", "p1"], tests=False))
@@ -628,14 +635,14 @@ class RowEstimateTest(unittest.TestCase):
self.assertIn("26/100 26%", rest)
self.assertEqual(elapsed, "0:26 / ~1:45")
- def test_a_single_module_reactor_has_no_module_bar_and_a_percent_from_tests_run(self):
+ def test_a_single_module_reactor_has_one_in_flight_cell_and_a_percent_from_tests_run(self):
b = self.board(lambda step, tool, sig=None: jr.Estimate(wall_s=100.0, units=1, rate=1.0, runs=5, tests=4000))
b.apply("reactor", dict(step="s", size=1, poms=[], tests=True))
b.apply("unit_start", dict(step="s", id="s/a", title="A", src="sub"))
b.apply("tests", dict(step="s", total=1000, fail=0, err=0, skip=0))
self.clock.advance(10)
cells, rest, elapsed = self.cells(b)
- self.assertIsNone(cells)
+ self.assertEqual(cells, [jr.PLAIN_GLYPHS["run"]])
self.assertNotIn("0/1", rest)
self.assertIn("~25%", rest)
self.assertIn("1,000 / ~4,000 tests", rest)
@@ -645,9 +652,29 @@ class RowEstimateTest(unittest.TestCase):
b.apply("reactor", dict(step="s", size=1, poms=[], tests=True))
self.clock.advance(40)
cells, rest, elapsed = self.cells(b)
- self.assertIsNone(cells)
+ self.assertEqual(cells, [jr.PLAIN_GLYPHS["run"]])
self.assertIn("~40%", rest)
+ def test_a_running_single_module_reactor_draws_one_in_flight_cell_in_every_glyph_set(self):
+ b = self.board(lambda step, tool, sig=None: jr.Estimate(wall_s=100.0, units=1, rate=1.0, runs=5))
+ b.apply("reactor", dict(step="s", size=1, poms=[], tests=True))
+ self.clock.advance(40)
+ for glyphs in (jr.PLAIN_GLYPHS, jr.NO_COLOR_GLYPHS, jr.COLOR_GLYPHS):
+ cells, rest, elapsed = jr.row_cells(b.rows["s"], glyphs, self.clock())
+ self.assertEqual(cells, [glyphs["run"]])
+ self.assertNotIn("0/1", rest)
+
+ def test_a_running_single_module_reactor_without_an_estimate_has_just_the_cell_and_the_tests(self):
+ b = self.board(None)
+ b.apply("reactor", dict(step="s", size=1, poms=[], tests=True))
+ b.apply("unit_start", dict(step="s", id="s/a", title="A", src="sub"))
+ b.apply("tests", dict(step="s", total=182, fail=0, err=0, skip=0))
+ self.clock.advance(18)
+ cells, rest, elapsed = self.cells(b)
+ self.assertEqual("".join(cells), jr.PLAIN_GLYPHS["run"])
+ self.assertEqual(rest, "182 tests")
+ self.assertEqual(elapsed, "0:18")
+
def test_a_single_module_reactor_draws_its_cell_once_the_module_ends(self):
b = self.board(lambda step, tool, sig=None: self.est)
b.apply("reactor", dict(step="s", size=1, poms=[], tests=True))
diff --git a/juneau-run/src/test/python/test_runner.py b/juneau-run/src/test/python/test_runner.py
index 6a02f8333d..605e8ae600 100644
--- a/juneau-run/src/test/python/test_runner.py
+++ b/juneau-run/src/test/python/test_runner.py
@@ -1184,6 +1184,7 @@ class ScriptApiTest(unittest.TestCase):
self.console.board.width.return_value = 9
self.console.board.detail = "modules"
self.console.board.pending.return_value = []
+ self.console.board.overall_handoff.return_value = None
patcher = mock.patch.object(jr, "_console", self.console)
patcher.start()
self.addCleanup(patcher.stop)
@@ -1341,6 +1342,12 @@ class ScriptApiTest(unittest.TestCase):
with jr.handoff() as env:
self.assertEqual(json.loads(env["JUNEAU_RUN_PENDING"]), [["release", "Release"]])
+ def test_handoff_exports_the_overall(self):
+ self.console.board.overall_handoff.return_value = {"elapsed": 12.5, "done": 2, "pending": [["install", 30.0]]}
+ with jr.handoff() as env:
+ self.assertEqual(json.loads(env["JUNEAU_RUN_OVERALL"]),
+ {"elapsed": 12.5, "done": 2, "pending": [["install", 30.0]]})
+
def test_console_active(self):
self.assertTrue(jr.console_active())
self.console.mode = None
diff --git a/juneau-run/src/test/python/test_session_plan.py b/juneau-run/src/test/python/test_session_plan.py
index f45407f414..26ab260a4f 100644
--- a/juneau-run/src/test/python/test_session_plan.py
+++ b/juneau-run/src/test/python/test_session_plan.py
@@ -12,7 +12,10 @@
# ***************************************************************************************************************************
"""The whole-run plan: Overall arithmetic (pure), plan() and the Board's plan state (spec 6)."""
+import json
+import os
import unittest
+from unittest import mock
from support import jr, reset_run_state
@@ -141,6 +144,40 @@ class BoardPlanTest(unittest.TestCase):
def test_nested_board_has_no_overall(self):
self.assertIsNone(self.board(nested=True).overall())
+ def nested_board(self, overall, plan=("a", "b", "c")):
+ env = {"JUNEAU_RUN_OVERALL": overall if isinstance(overall, str) else json.dumps(overall)}
+ with mock.patch.dict(os.environ, env):
+ return self.board(plan=plan, nested=True)
+
+ def test_nested_board_with_a_parent_overall_adds_the_parents_steps(self):
+ b = self.nested_board({"elapsed": 40, "done": 2, "pending": [["install", 20.0], ["push", None]]})
+ o = b.overall()
+ self.assertEqual((o.done, o.total), (2, 7)) # the parent's 2 done, the child's 3, 2 pending
+ self.assertTrue(o.lower_bound) # push has no figure
+ self.assertEqual(o.remaining, 225) # 60 + 100 + 40 + 20, shown on the 15s step
+ self.assertEqual(o.percent, 15) # the parent's 40s count as elapsed: 40 / (40 + 225)
+
+ def test_the_parents_pending_steps_the_child_plans_are_not_counted_twice(self):
+ o = self.nested_board({"elapsed": 0, "done": 0, "pending": [["b", 100.0], ["commit", 5.0]]}).overall()
+ self.assertEqual(o.total, 4) # a, b, c and commit
+
+ def test_malformed_parent_overall_is_ignored(self):
+ for bad in ("not json", "[1]", '{"elapsed": "x"}', '{"elapsed": 1, "done": 1, "pending": [[1]]}'):
+ self.assertIsNone(self.nested_board(bad).overall(), bad)
+
+ def test_the_parent_overall_is_ignored_by_a_top_level_board(self):
+ with mock.patch.dict(os.environ, {"JUNEAU_RUN_OVERALL": json.dumps({"elapsed": 40, "done": 2, "pending": []})}):
+ self.assertEqual(self.board().overall().total, 3)
+
+ def test_overall_handoff_carries_elapsed_done_and_pending(self):
+ b = self.board()
+ b.apply(*start("a")); self.clock.advance(20); b.apply(*end("a"))
+ b.apply(*start("b")); self.clock.advance(5)
+ self.assertEqual(b.overall_handoff(), {"elapsed": 25.0, "done": 1, "pending": [["c", 40.0]]})
+
+ def test_overall_handoff_without_a_plan_is_none(self):
+ self.assertIsNone(self.board(plan=None).overall_handoff())
+
def test_running_step_on_the_live_units_path(self):
b = self.board()
b.apply(*start("a"))
diff --git a/scripts/push.py b/scripts/push.py
index d57f5f115d..ff856ea302 100755
--- a/scripts/push.py
+++ b/scripts/push.py
@@ -1039,7 +1039,7 @@ def main():
#: are test.py's rows; the others are this script's.
PLAN_LABELS = {
"prechecks": "Prechecks", "sonar": "Sonar", "tracker": "Tracker", "container-tags": "Tags",
- "bom": "BOM", "build": "Compile", "tests": "Tests", "py-tests": "Script tests", "js-tests": "Browser tests", "timing": "Timing",
+ "bom": "BOM", "build": "Compile", "tests": "Java tests", "py-tests": "Python tests", "js-tests": "Browser tests", "timing": "Timing",
"install": "Install", "commit": "Commit", "push": "Push", "docs-smoke": "Docs build",
"docs-commit": "Docs", "docs-push": "Docs push",
}
@@ -1382,7 +1382,7 @@ def _push_steps(s, args, run, console, script_dir, juneau_root): # NOSONAR pyth
_test_start = time.time()
test_cmd = build_test_command(test_script, args)
installed_by_tests = "--full" in test_cmd
- # The child draws its own Compile/Tests/Browser tests/Perf rows; ours closes until it exits. Its
+ # The child draws its own Compile/Java tests/Browser tests/Perf rows; ours closes until it exits. Its
# environment carries JUNEAU_PUSH_ACTIVE (test.py then leaves the end-of-run bell to us) and, with
# markers on, JUNEAU_RUN_N_BASE reserving the numbers of the steps it contributes so the whole run
# stays in order. Neither is set in our own environment, so later children don't inherit them.
@@ -1391,7 +1391,7 @@ def _push_steps(s, args, run, console, script_dir, juneau_root): # NOSONAR pyth
_test_wall_sec = int(time.time() - _test_start)
if result.returncode != 0:
return aborted("\n❌ Build process aborted due to test failures.")
- say(f"✅ Step {step_num}: Tests passed")
+ say(f"✅ Step {step_num}: Java tests passed")
_append_test_run_history(juneau_root, _test_wall_sec)
except Exception as e:
say(f"\n❌ Error running tests: {e}", "error")
@@ -1400,7 +1400,7 @@ def _push_steps(s, args, run, console, script_dir, juneau_root): # NOSONAR pyth
# Fallback to direct mvn test if test.py doesn't exist
_test_start = time.time()
_mvn_ok = run_marked(
- "tests", "Tests",
+ "tests", "Java tests",
["mvn", "test"],
f"🧪 Step {step_num}: Running tests...",
juneau_root,
@@ -1423,7 +1423,7 @@ def _push_steps(s, args, run, console, script_dir, juneau_root): # NOSONAR pyth
step_num += 1
else:
say(f"\n⏭️ Step {step_num}: Skipping tests (--skip-tests flag)")
- with run.row("tests", "Tests", label="Tests") as tests_row:
+ with run.row("tests", "Java tests", label="Java tests") as tests_row:
tests_row.skip("--skip-tests")
step_num += 1
@@ -1432,7 +1432,7 @@ def _push_steps(s, args, run, console, script_dir, juneau_root): # NOSONAR pyth
if installed_by_tests:
# Still the protocol step `install` (end status skip), so the release manager's step list doesn't change.
with marked_step("install", "Build and install", label="Install") as install_step:
- install_step.skip("done by Tests")
+ install_step.skip("done by Java tests")
if not console:
say(f"\n⏭️ Step {step_num}: Build and install already done by test.py --full")
elif not run_marked(
diff --git a/scripts/test.py b/scripts/test.py
index 89022b9543..4affbddfeb 100755
--- a/scripts/test.py
+++ b/scripts/test.py
@@ -44,7 +44,7 @@ Environment:
JUNEAU_MVN_WRAPPER Optional prefix for every mvn command (e.g. a lock script that serializes
concurrent runs on one checkout).
-Script tests:
+Python tests:
After the Maven tests pass, scripts/tests (the tooling's own pytest suite) runs as its own row. The launcher is
`python3 -m pytest` when pytest is importable, else `uv run --native-tls --with pytest` when uv is on the PATH; with neither,
the step prints a notice and skips. Nothing is installed.
@@ -615,7 +615,7 @@ def test(no_container=False):
cmd = f"mvn test {PARALLELISM} -Drat.skip=true"
if no_container:
cmd += " -DexcludedGroups=container"
- return run_command(cmd, "tests", "Tests", label="Tests", summarize=_record_buckets)
+ return run_command(cmd, "tests", "Java tests", label="Java tests", summarize=_record_buckets)
# Set in the pytest child so a test that reaches script_tests() again cannot launch the suite recursively.
@@ -644,14 +644,14 @@ def script_tests_command(launcher):
def script_tests(launcher=None, runner=None):
"""The scripts/tests pytest suite as its own row. Returns 0 on pass or skip, non-zero on failure."""
if os.environ.get(SCRIPT_TESTS_ACTIVE):
- say("\n⚠️ Skipping Script tests: already running inside them (no recursion).", "warn")
+ say("\n⚠️ Skipping Python tests: already running inside them (no recursion).", "warn")
return 0
launcher = launcher or script_tests_launcher()
if launcher is None:
- say("\n⚠️ Skipping Script tests: neither pytest nor uv found (python3 -m pytest / uv run --native-tls --with pytest).", "warn")
+ say("\n⚠️ Skipping Python tests: neither pytest nor uv found (python3 -m pytest / uv run --native-tls --with pytest).", "warn")
return 0
cmd = script_tests_command(launcher)
- say("\n🐍 Running Script tests (scripts/tests)...")
+ say("\n🐍 Running Python tests (scripts/tests)...")
say(f"Running: {' '.join(cmd)}")
say("-" * 80) # NOSONAR python:S1192 - the same banner rule as run_command
env = dict(os.environ, PYTHONDONTWRITEBYTECODE="1", **{SCRIPT_TESTS_ACTIVE: "1"})
@@ -659,9 +659,9 @@ def script_tests(launcher=None, runner=None):
code = runner(cmd, env)
else:
run = _juneau.load()[0]
- code = run.run_tool(cmd, "pytest", "py-tests", "Script tests", n=next_step_number(), cwd=str(REPO_ROOT),
- env=env, capture=True, label="Script tests").exit
- say("\n✅ Script tests passed!" if code == 0 else "\n❌ Script tests failed!", "info" if code == 0 else "error")
+ code = run.run_tool(cmd, "pytest", "py-tests", "Python tests", n=next_step_number(), cwd=str(REPO_ROOT),
+ env=env, capture=True, label="Python tests").exit
+ say("\n✅ Python tests passed!" if code == 0 else "\n❌ Python tests failed!", "info" if code == 0 else "error")
return code
@@ -851,11 +851,11 @@ def _main(): # NOSONAR python:S3776 -- Cognitive complexity is acceptable for t
if exit_code != 0:
_, failures, errors = parse_test_results(last_test_output)
if failures is not None and errors is not None:
- say(f"\n❌ Tests failed! ({failures + errors} failed: {failures} failures, {errors} errors)", "error")
+ say(f"\n❌ Java tests failed! ({failures + errors} failed: {failures} failures, {errors} errors)", "error")
else:
- say("\n❌ Tests failed!", "error")
+ say("\n❌ Java tests failed!", "error")
else:
- say("\n✅ Tests passed!")
+ say("\n✅ Java tests passed!")
if exit_code != 0:
return exit_code
perf_exit = run_perf_guard(test_elapsed, PERF_BASELINE, module_times_, enforce=args.enforce_perf, unmapped=unmapped)
diff --git a/scripts/tests/README.md b/scripts/tests/README.md
index 5b8aaf2bca..355598baa6 100644
--- a/scripts/tests/README.md
+++ b/scripts/tests/README.md
@@ -17,7 +17,7 @@ remains here is a juneau-only script with no counterpart elsewhere.
## Running
-The suite must also pass under a push-like environment (`JUNEAU_RUN_SESSION`, `JUNEAU_PUSH_ACTIVE`, `JUNEAU_RUN_ACTIVE`, `JUNEAU_RUN_N_BASE` set), because `push.py`'s Script tests step runs it that way; any test that depends on those variables being unset must clear them itself.
+The suite must also pass under a push-like environment (`JUNEAU_RUN_SESSION`, `JUNEAU_PUSH_ACTIVE`, `JUNEAU_RUN_ACTIVE`, `JUNEAU_RUN_N_BASE` set), because `push.py`'s Python tests step runs it that way; any test that depends on those variables being unset must clear them itself.
`pytest` is not vendored anywhere in this repo (it's pure-stdlib elsewhere in `scripts/` on
purpose). Two easy ways to run this suite without installing anything globally:
diff --git a/scripts/tests/conftest.py b/scripts/tests/conftest.py
index d1429c58ae..ca0cae0724 100644
--- a/scripts/tests/conftest.py
+++ b/scripts/tests/conftest.py
@@ -30,7 +30,7 @@ RUN_MODULE_PATH = Path(__file__).resolve().parent.parent.parent / "juneau-run" /
@pytest.fixture(autouse=True)
def _no_nested_script_tests(monkeypatch):
- """test.py's Script tests step runs this suite; a test that drives test.py's _main() must not launch it again."""
+ """test.py's Python tests step runs this suite; a test that drives test.py's _main() must not launch it again."""
monkeypatch.setenv("JUNEAU_SCRIPT_TESTS_ACTIVE", "1")
diff --git a/scripts/tests/test_run_adoption.py b/scripts/tests/test_run_adoption.py
index 56d8344190..76acaa7f7d 100644
--- a/scripts/tests/test_run_adoption.py
+++ b/scripts/tests/test_run_adoption.py
@@ -107,7 +107,7 @@ def markers(text):
def test_test_py_default_path_records_history_through_run_tool(test_mod, fake_mvn, run_history, tmp_path, capfd):
"""Markers off and default sinks: a step-id command still goes through run_tool, so its row is recorded."""
run_history.start(tmp_path)
- code, out = test_mod.run_command("mvn test", "tests", "Tests")
+ code, out = test_mod.run_command("mvn test", "tests", "Java tests")
assert (code, out) == (0, "fake mvn: test\n")
assert "##run" not in capfd.readouterr().out
records = run_history.store("test", repo=tmp_path).read()
@@ -115,7 +115,7 @@ def test_test_py_default_path_records_history_through_run_tool(test_mod, fake_mv
def test_test_py_default_path_output_is_unchanged(test_mod, fake_mvn, capfd):
- code, _ = test_mod.run_command("mvn test", "tests", "Tests")
+ code, _ = test_mod.run_command("mvn test", "tests", "Java tests")
assert code == 0
assert capfd.readouterr().out == "Running: mvn test\n" + "-" * 80 + "\nfake mvn: test\n"
@@ -123,7 +123,7 @@ def test_test_py_default_path_output_is_unchanged(test_mod, fake_mvn, capfd):
def test_mvn_wrapper_with_and_still_runs_through_the_shell(test_mod, monkeypatch):
monkeypatch.setenv("JUNEAU_MVN_WRAPPER", "echo first &&")
monkeypatch.setattr(test_mod._juneau.load()[0], "run_tool", _counting_run_tool(test_mod._juneau.load()[0].run_tool))
- _, out = test_mod.run_command("mvn --version", "tests", "Tests")
+ _, out = test_mod.run_command("mvn --version", "tests", "Java tests")
assert out.startswith("first\n") # the && part ran in the same shell as the rest of the command
assert test_mod._juneau.load()[0].run_tool.calls == 1
@@ -146,12 +146,12 @@ def _counting_run_tool(real):
def test_test_py_markers_on_runs_the_command_as_a_step(test_mod, fake_mvn, monkeypatch, capfd):
monkeypatch.setenv("RUN_MARKERS", "1")
- code, out = test_mod.run_command("mvn test -T1C -Dtest='A B'", "tests", "Tests")
+ code, out = test_mod.run_command("mvn test -T1C -Dtest='A B'", "tests", "Java tests")
assert code == 0
assert out == "fake mvn: test -T1C -Dtest=A B\n"
shown = capfd.readouterr().out
assert markers(shown) == [
- {"ev": "step", "id": "tests", "n": 1, "title": "Tests"},
+ {"ev": "step", "id": "tests", "n": 1, "title": "Java tests"},
{"ev": "end", "id": "tests", "status": "ok"},
]
assert "fake mvn: test" in shown
@@ -160,14 +160,14 @@ def test_test_py_markers_on_runs_the_command_as_a_step(test_mod, fake_mvn, monke
def test_test_py_step_numbers_continue_after_n_base(test_mod, fake_mvn, monkeypatch, capfd):
monkeypatch.setenv("RUN_MARKERS", "1")
monkeypatch.setenv("JUNEAU_RUN_N_BASE", "3")
- test_mod.run_command("mvn test", "tests", "Tests")
+ test_mod.run_command("mvn test", "tests", "Java tests")
assert markers(capfd.readouterr().out)[0]["n"] == 4
def test_test_py_failure_exit_code_is_returned_and_marked(test_mod, fake_mvn, monkeypatch, capfd):
monkeypatch.setenv("RUN_MARKERS", "1")
monkeypatch.setenv("FAKE_MVN_EXIT", "3")
- code, _ = test_mod.run_command("mvn test", "tests", "Tests")
+ code, _ = test_mod.run_command("mvn test", "tests", "Java tests")
assert code == 3
assert markers(capfd.readouterr().out)[-1] == {"ev": "end", "id": "tests", "status": "fail", "exit": 3}
@@ -176,7 +176,7 @@ def test_test_py_routing_flags_work_without_markers(test_mod, fake_mvn, monkeypa
log = tmp_path / "full.log"
monkeypatch.setenv("JUNEAU_RUN_CONSOLE", "none")
monkeypatch.setenv("JUNEAU_RUN_FULL_LOG", str(log))
- code, out = test_mod.run_command("mvn test", "tests", "Tests")
+ code, out = test_mod.run_command("mvn test", "tests", "Java tests")
assert code == 0 and out == "fake mvn: test\n"
assert log.read_text() == "fake mvn: test\n"
assert "fake mvn" not in capfd.readouterr().out
@@ -185,7 +185,7 @@ def test_test_py_routing_flags_work_without_markers(test_mod, fake_mvn, monkeypa
def test_test_py_wrapper_prefix_stays_in_the_command(test_mod, monkeypatch, capfd):
monkeypatch.setenv("RUN_MARKERS", "1")
monkeypatch.setenv("JUNEAU_MVN_WRAPPER", "echo wrapped")
- _, out = test_mod.run_command("mvn test", "tests", "Tests")
+ _, out = test_mod.run_command("mvn test", "tests", "Java tests")
assert out == "wrapped mvn test\n"
@@ -394,7 +394,7 @@ def test_run_test_script_markers_on_gives_the_child_its_own_session(push_mod, mo
def test_test_py_wrapper_with_and_and_markers_on_runs_through_a_shell(test_mod, monkeypatch):
monkeypatch.setenv("RUN_MARKERS", "1")
monkeypatch.setenv("JUNEAU_MVN_WRAPPER", "echo first &&")
- code, out = test_mod.run_command("mvn --version", "tests", "Tests")
+ code, out = test_mod.run_command("mvn --version", "tests", "Java tests")
assert out.startswith("first\n") # the && part ran in the same shell as the rest of the command
@@ -566,7 +566,7 @@ def test_the_skipped_install_shows_done_by_tests(push_mod, gates, standalone, mo
monkeypatch.setattr(sys, "argv", ["push.py", "--test-only"])
assert push_mod.main() == 0
[install] = [f for f in events.of("step_end") if f["id"] == "install"]
- assert (install["status"], install["summary"]) == ("skip", "done by Tests")
+ assert (install["status"], install["summary"]) == ("skip", "done by Java tests")
class FakeTimings:
diff --git a/scripts/tests/test_script_tests_step.py b/scripts/tests/test_script_tests_step.py
index 2c7de491f1..8f954ec6dd 100644
--- a/scripts/tests/test_script_tests_step.py
+++ b/scripts/tests/test_script_tests_step.py
@@ -11,7 +11,7 @@
# * specific language governing permissions and limitations under the License.
# ***************************************************************************************************************************
"""
-Tests for the Script tests step in scripts/test.py (the scripts/tests pytest suite as its own row): launcher choice,
+Tests for the Python tests step in scripts/test.py (the scripts/tests pytest suite as its own row): launcher choice,
the skip notice, the pass/fail result, and the row in push.py's plan. Nothing here runs pytest, mvn or push.py's main().
"""
@@ -86,7 +86,7 @@ def test_skips_with_visible_notice_when_no_launcher(monkeypatch, test_mod):
said = []
monkeypatch.setattr(test_mod, "say", lambda text, level="info": said.append((text, level)))
assert test_mod.script_tests() == 0
- assert any("Skipping Script tests" in text and level == "warn" for text, level in said)
+ assert any("Skipping Python tests" in text and level == "warn" for text, level in said)
@pytest.mark.parametrize("code", [0, 1])
@@ -112,7 +112,7 @@ def test_default_runner_is_its_own_pytest_row(monkeypatch, test_mod):
return type("R", (), {"exit": 0})()
monkeypatch.setattr(test_mod._juneau, "load", lambda: (FakeRun(),))
assert test_mod.script_tests(launcher=["pytest"]) == 0
- assert calls == [("pytest", "py-tests", "Script tests", "Script tests")]
+ assert calls == [("pytest", "py-tests", "Python tests", "Python tests")]
def test_skips_when_already_running_inside_the_suite(monkeypatch, test_mod):
@@ -137,4 +137,4 @@ def test_push_plan_lists_the_row_after_tests(push_mod):
args = argparse.Namespace(test_only=True, sonarqube=False, tracker_audit=False, skip_tests=False, js_tests=False)
ids = [step_id for step_id, _ in push_mod.push_plan(args, SCRIPTS_DIR, SCRIPTS_DIR.parent, False)]
assert ids.index("py-tests") == ids.index("tests") + 1
- assert push_mod.PLAN_LABELS["py-tests"] == "Script tests"
+ assert push_mod.PLAN_LABELS["py-tests"] == "Python tests"
diff --git a/scripts/tests/test_test_py_history.py b/scripts/tests/test_test_py_history.py
index b5de35c642..68deed707c 100644
--- a/scripts/tests/test_test_py_history.py
+++ b/scripts/tests/test_test_py_history.py
@@ -143,7 +143,7 @@ def test_the_tests_record_fits_max_record_on_the_real_layout(run_history, tmp_pa
series = {"surefire_s": per_module, "reactor_s": per_module}
series.update({f"surefire_s.{bucket}": per_module
for bucket in ("core", "container.springboot", "container.jetty", "container.tomcat")})
- record = {"v": 1, "ts": "2026-10-14T00:00:00Z", "step": "tests", "tool": "maven", "title": "Tests",
+ record = {"v": 1, "ts": "2026-10-14T00:00:00Z", "step": "tests", "tool": "maven", "title": "Java tests",
"sig": "0123456789abcdef", "commit": "abcdef1234", "ok": True, "complete": True, "wall_s": 1234.567,
"units": {"kind": "modules", "total": len(paths), "done": len(paths)}, "tests": 99999,
"subs": per_module, "series": series}
diff --git a/scripts/tests/test_test_py_run_command.py b/scripts/tests/test_test_py_run_command.py
index 4a1a82ad3e..c8cfed2c0c 100644
--- a/scripts/tests/test_test_py_run_command.py
+++ b/scripts/tests/test_test_py_run_command.py
@@ -81,7 +81,7 @@ def test_a_step_id_command_still_streams_in_plain_mode(test_mod, monkeypatch, tm
monkeypatch.setattr("sys.stdout", Recorder())
code, out = test_mod.run_command(
f"echo first; for i in $(seq 50); do [ -f '{marker}' ] && echo second && exit 0; sleep 0.1; done; exit 1",
- "tests", "Tests")
+ "tests", "Java tests")
assert code == 0
assert out == "first\nsecond\n"
assert any("second" in s for s in seen)