Skip to content

roxxorarc/pythonette-42

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

40 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WARNING: Please note that this project is in early development and may not be fully functional, if you notice any issues with the tests (e.g. false positives, false negatives or any other problems), please report them by opening an issue on GitHub with a detailed description. Thank you for your understanding and support !

🐍 pythonette

A test automation framework for the 42 Python modules.

pythonette runs flake8, executes each exercise against a battery of test cases, and reports the result with rich panels. It is designed to install and run on 42 workstations without any admin privileges.

πŸ“¦ Install

One-liner (recommended)

bash -c "$(curl -fsSL https://raw.githubusercontent.com/roxxorarc/pythonette-42/main/install.sh)"

Manual

git clone https://github.com/roxxorarc/pythonette-42.git
cd pythonette-42
./install.sh

After install

If ~/.local/bin is not already on your PATH, the installer adds it to ~/.zshrc automatically. Apply it to your current session with:

source ~/.zshrc

Requirements: Python 3.10 or newer and git. No admin privileges required.

πŸš€ Usage

From inside any directory containing your exercise files:

pythonette                  # auto-detect, run every detected exercise
pythonette -m 00            # only module 00
pythonette -e ex02          # only the ex02 exercise (any module)
pythonette --diff           # show colored diffs on failure
pythonette --explain        # print a hint on each failure
pythonette -u               # git pull + reinstall
pythonette -V               # version

Detection is filename-based. A file like ft_plot_area.py is identified as module 00 / ex02 regardless of where it sits in your tree, so any layout works:

my_42_python/
β”œβ”€β”€ python_module_00/ex2/ft_plot_area.py
└── python_module_01/ex0/ft_garden_intro.py

πŸ“š Supported modules

# Title Exercises Coverage highlights
00 Growing Code β€” Python fundamentals through garden data 8 Basic syntax, conditionals, loops, recursion, type hints
01 Code Cultivation β€” object-oriented garden systems 7 Classes, inheritance, dunder methods, encapsulation
02 Garden Guardian β€” data engineering for smart agriculture 5 Exceptions, custom error hierarchies, try/except/finally
03 Data Quest β€” mastering Python collections 7 Lists, tuples, sets, dicts, comprehensions, argv
04 Data Archivist β€” Digital Preservation in the Cyber Archives 4 File I/O, with context managers, argv pipelines
05 Code Nexus β€” Polymorphic Data Streams in the Digital Matrix 3 Abstract base classes, polymorphism, typing.Protocol
06 The Codex β€” Mastering Python's Import Mysteries 4 Absolute/relative imports, package layout, circular imports
07 DataDeck β€” Abstract Card Architecture 3 ABCs, factories, capability mixins, strategy pattern
08 The Matrix β€” Welcome to the Real World of Data Engineering 3 Virtual envs, requirements.txt / pyproject.toml, dotenv
09 Cosmic Data β€” Discover Pydantic Models & Validation 3 Pydantic 2 BaseModel, Field constraints, @model_validator
10 FuncMage Chronicles β€” Master the Ancient Arts of Functional Programming 5 Lambdas, higher-order functions, closures, functools, decorators

βœ… Checks

For each detected exercise:

  1. Style β€” flake8 and mypy (strict) run on every file in the exercise. Failures are listed inline but do not stop the rest of the checks. The mypy cache lives under ~/.cache/pythonette/mypy/ so warm runs are an order of magnitude faster than cold ones.
  2. Static checks β€” AST-only assertions (StructureCheck, AuthorizedCheck, ImportCheck, …) verify structure without executing the student code.
  3. Runtime checks β€” the student files are copied into a temp dir, then a generated harness imports/calls/runs them in a subprocess. Used for SignatureCheck, AssertCheck, RunCheck, ScriptCheck, etc. Default timeout: 5 seconds (treated as a possible infinite loop).
  4. Output matching β€” stdout is matched against expected_stdout (exact) or expected_contains / stdout_contains (substring list). Non-zero exit codes and tracebacks surface as the failure reason.

🀝 Contributing

  • CONTRIBUTING.md β€” project architecture, the full check toolbox, and a worked example of adding an exercise or a new module.

πŸ“„ License

About

🐍 Test automation framework for the 42 Python projects

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors