Skip to content

Commit 5149728

Browse files
redsun82Copilot
andcommitted
Just: pin what a root offers apart from what it runs
`--all-checks` enables the checks a justfile offers; a root can separately pass checks unconditionally, which are not offers. Nothing distinguished the two, and they are easy to conflate when reading a justfile. The flag is injected on every language test run rather than typed, so it means "enable whatever this root offers" and a root offering nothing enables nothing. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent b3035cd commit 5149728

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

‎misc/just/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ Another point is how launching QL tests can be tweaked:
158158
- you can add the additional checks that CI does with `--all-checks` or the `+`
159159
abbreviation. These additional checks are configured in justfiles per language, and
160160
correspond to all the additional checks that CI adds (but that a dev might not want to
161-
run by default).
161+
run by default). Checks a root passes unconditionally are not offers: what it offers
162+
is what `--all-checks` can enable
162163

163164
Test arguments are passed around as `just` lists (`set lists`), so they reach the
164165
underlying runner already split and arguments containing spaces survive intact.

‎misc/just/test_codeql_test_run.py‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,37 @@ def test_an_empty_argument_does_not_disturb_a_separator(self):
146146
self.assertNotIn("--", flags("", "--", "--check-databases"))
147147

148148

149+
class TestOfferedChecks(unittest.TestCase):
150+
"""What a root offers and what `--all-checks` enables are separate things.
151+
152+
These go through `main` because that is where the two meet. `--all-checks` is
153+
injected on every language test run rather than typed, so it means "enable whatever
154+
this root offers" and not "I want more coverage": a root offering nothing has to
155+
stay runnable through it.
156+
"""
157+
158+
def test_an_offered_check_is_applied_when_asked_for(self):
159+
applied = flags("--extra-check=--check-databases", "--all-checks")
160+
self.assertIn("--check-databases", applied)
161+
162+
def test_an_offered_check_stays_held_back_until_it_is(self):
163+
self.assertNotIn("--check-databases", flags("--extra-check=--check-databases"))
164+
165+
def test_asking_for_checks_a_root_offers_none_of_enables_nothing(self):
166+
self.assertEqual(paths("--all-checks", "some/test"), ["some/test"])
167+
self.assertEqual(flags("--all-checks", "some/test"), flags("some/test"))
168+
169+
def test_a_check_passed_unconditionally_is_not_an_offer(self):
170+
# A root can mean to run a check always rather than put it behind the flag. That
171+
# is a flag like any other here, so it neither becomes an offer nor is withheld
172+
# until the offers are asked for.
173+
always = flags("--check-databases", "some/test")
174+
self.assertIn("--check-databases", always)
175+
self.assertEqual(
176+
flags("--check-databases", "--all-checks", "some/test"), always
177+
)
178+
179+
149180
class TestSettings(unittest.TestCase):
150181
"""`RAM_PER_THREAD` and `CPUS` are read back after assignments are applied.
151182

0 commit comments

Comments
 (0)