Python implementation of Testeranto
Project description
Pitono
The python implementation of testeranto.
Setup
- Create a virtual environment:
python3 -m venv venv
- Activate the virtual environment:
source venv/bin/activate
- Install the package in development mode:
pip install -e .
Running Tests
Make sure the virtual environment is activated, then run your Python tests normally.
Flavored (Pythonic) Version
Pitono now includes a Pythonic, decorator-based syntax for writing tests:
from pitono.flavored import suite, given, when, then
@suite("Calculator Tests")
class CalculatorTests:
@given("a new calculator")
def setup_calculator(self):
return Calculator()
@when("adding {x} and {y}")
def add_numbers(self, calculator, x, y):
return calculator.add(x, y)
@then("result should be {expected}")
def verify_result(self, calculator, expected):
assert calculator.get_result() == expected
return calculator
# Run tests
tests = CalculatorTests()
instance = tests.run_tests()
Features:
- Decorator-based syntax: Use
@suite,@given,@when,@thendecorators - String interpolation: Use
{parameter}placeholders in descriptions - Automatic conversion: Flavored tests are automatically converted to baseline format
- unittest integration: Use
PitonoTestCasefor integration with Python's unittest framework - Backward compatibility: Works alongside existing baseline tests
Integration with unittest:
import unittest
from pitono.flavored import PitonoTestCase
class TestCalculator(PitonoTestCase):
@given("a new calculator")
def setup_calculator(self):
return Calculator()
# ... test methods
if __name__ == "__main__":
unittest.main()
Examples
See examples/flavored_example.py for a complete working example.
Documentation
For more details, see:
src/lib/pitono/tickets/pythonic.md- Design document for the flavored versionsrc/lib/pitono/src/flavored.py- Implementation of the flavored version
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pitono-0.1.26.tar.gz.
File metadata
- Download URL: pitono-0.1.26.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0032c4db0882f4bee507eda3657bf59b5907854053ede9ed5fe7499a83c66aa3
|
|
| MD5 |
18fc543be24a22dd19ca2a80ed623af3
|
|
| BLAKE2b-256 |
b1e3b0a1a7816a958df3b9546af3ba39a927caa5b553ad1dfa38cefe46b41f07
|
File details
Details for the file pitono-0.1.26-py3-none-any.whl.
File metadata
- Download URL: pitono-0.1.26-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15aba93bfe6ba5b5d863a40e589d292cce291b8f62e5c41208c6b2e1b1b78b81
|
|
| MD5 |
c90a3806d89860803641e2e89f6fe083
|
|
| BLAKE2b-256 |
adb32cc1fc405fe2e8be1439f7ac79e5371c7a35be264ce267d69b98c407a291
|