casebench
test cases straight onto the board.
git clone https://owenrusk.dev/casebench.git
commit 867ea6227889a5eb4d6fd5f714462a1ea0d89119 parent 991e1e7c89d98f4e4ac4028b4ac6770be6ce857b author Owen Rusk <owen@papermothgames.com> date 2026-02-04 13:07:33 -0600
unlock: carry on past boards that weren't locked with --all it stopped at the first board without the lock and left the rest locked.
| casebench/cli.py | +8 | -3 |
| tests/test_lock.py | +1 | -1 |
diff --git a/casebench/cli.py b/casebench/cli.py index 30f3201..b619993 100644 --- a/casebench/cli.py +++ b/casebench/cli.py @@ -150,10 +150,15 @@ def ask() -> list[str]: def run_unlock(store: Store, args: argparse.Namespace) -> None: + unlocked = 0 for who in targets(store, args):- if not store.unlock(who, args.case):- raise Fail(f"{args.case} isn't locked for {who.handle}")- print(f"{who.handle}: unlocked {args.case}")+ if store.unlock(who, args.case): + unlocked += 1 + print(f"{who.handle}: unlocked {args.case}") + else: + print(f"{who.handle}: {args.case} wasn't locked") + if not unlocked: + raise Fail(f"{args.case} wasn't locked anywhere") def run_list(store: Store, args: argparse.Namespace) -> None: diff --git a/tests/test_lock.py b/tests/test_lock.py index c97df15..cb01704 100644 --- a/tests/test_lock.py +++ b/tests/test_lock.py @@ -102,7 +102,7 @@ class LockCommandTest(unittest.TestCase): def test_unlock_when_not_locked(self): code, _, err = run(self.store, "unlock", "test-lost-umbrella", "--player", "owen") self.assertEqual(code, 1)- self.assertIn("isn't locked", err)+ self.assertIn("wasn't locked anywhere", err) def test_locks_a_runtime_case(self): self.store.runtime_case(self.owen, "case-x", "A real case")