MLflow Jedi ships with aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/elenacarino-max/Pildora4_ext_StarWars/llms.txt
Use this file to discover all available pages before exploring further.
unittest suite that validates the four pillars of the application’s correctness: the question bank content, mission definitions, AST-based code validation logic, and database operations. The tests are designed to run quickly, require no network access, and never touch the production data directory — making them safe to run at any time, including immediately before a classroom session.
Running the tests
From theapp-v2/ directory with dependencies installed, run:
-v flag prints each test case name and result to the terminal. A fully passing run ends with OK; any failure or error prints a traceback identifying the broken component.
Test coverage
The suite is split across four files, each targeting a distinct layer of the application.test_questions.py — question bank integrity
Validates the structure and completeness of the 50-question bank in core/questions.py.
- Asserts that exactly 50 questions exist and all 50 have unique
idvalues. - Verifies that every question’s
solutionfield is accepted by thevalidate_question_answervalidator — meaning no question in the bank has an invalid or unreachable correct answer. - Checks that a session selection (
choose_session_question_ids) always returns exactly 6 questions, one per topic, covering the complete set ofTOPICS(Experiment,Run,Parameters,Metrics,Artifacts,Model).
test_missions.py — mission content validation
Validates the static mission and holocron definitions in core/missions.py and core/holocrons.py.
- Asserts that exactly 6 chambers, 3 missions, and 7 holocrons are defined.
- Checks that the set of mission
idvalues (tatooine,coruscant,mustafar) matches the keys inORIENTATIVE_RESULTS— every mission has expected reference metrics. - Verifies that every holocron has a non-empty
task, exactly 4 steps, and a non-emptydeliverablefield.
test_code_validator.py — AST-based code validation
Tests the safe, execution-free code analysis performed by core/code_validator.py. Student submissions are never executed; the validator inspects the abstract syntax tree instead.
- Accepts correct code: a valid
mlflow.set_experiment(...)call passes theexperimentchamber. - Rejects wrong function category: using
mlflow.log_paramin ametricschamber returnsvalid=Falsewith a message containing"métrica". - Rejects unauthorised calls: a
open(...)call in aparameterschamber is rejected with a message containing"autorizada". - Enforces mission submission structure: a submission that logs only one artifact (instead of the required two) fails with a message containing
"dos artefactos".
test_database.py — database operations
Tests the full lifecycle of a session using a temporary SQLite database patched over GAME_DB, so production data is never affected.
- Session and team progression: creates a session, joins a team (
"Guardianes de Naboo"), verifies initialchamber_indexis0, completes chamber 0, and confirmschamber_indexadvances to1andscoreequals20. - Defense validation: attempts to save a defense where
selected_runanddiscarded_runare the same value and asserts aValueErroris raised — the app prevents teams from comparing a run against itself. - Question persistence and penalty: verifies that a session is created with exactly 6 question IDs and that those IDs are consistently returned by
get_session. After 5 consecutive failed attempts,force_advance_chamberadvances the team but applies a penalty of −10 points.
Prerequisites
All test dependencies are provided by the standardrequirements.txt:
Tests run against an in-memory or temporary directory database patched
via
unittest.mock.patch. They do not read from or write to the production
data/ directory. You can run the suite while the application is running
without any risk to live session data.