Test tool (Benchmark / Test / Assertion / etc...)
Project description
๐ฆ Jarbin-ToolKit:JarTest v0.0.1.4
Deterministic test execution framework based on structured assertions, benchmarking, and controlled test discovery
๐น Short Description
Jarbin-ToolKit JarTest is a lightweight testing and benchmarking framework that executes Python test functions through structured Benchmark containers, records assertions, measures execution time, and aggregates results in a deterministic reporting system.
It provides:
- automatic test discovery based on naming conventions
- structured assertion tracking with contextual recording
- execution benchmarking with precise timing
- stdout/stderr capture utilities
- hierarchical test execution and reporting
It is not a unit testing clone of pytest, but a deterministic execution and benchmarking harness with integrated assertion tracking.
๐น Authors
- Nathan (Jarjarbin06)
- Jarbin Studio
๐น License
GPL v3
๐น Target Audience
This library is intended for:
- Python developers building custom test frameworks
- developers requiring deterministic benchmarking pipelines
- engineers designing structured validation systems
- projects needing lightweight alternatives to full testing ecosystems
๐น Platform Support
- Python โฅ 3.10
- Standard library only (except internal Jarbin-ToolKit dependencies)
- Linux / Windows / macOS compatible
๐น Purpose
Jarbin-ToolKit JarTest aims to:
- execute test functions in isolated benchmarking environments
- capture execution time with high-resolution measurement
- collect structured assertion results during execution
- aggregate errors, exceptions, and outputs in a unified model
- provide deterministic reporting across multiple test runs
It is not a general-purpose testing framework, but a structured benchmarking and assertion orchestration layer over Python callables.
๐น Key Features
- automatic test discovery via
JT_prefix - benchmark execution wrapper (
Benchmark) - assertion system with contextual collection
- execution timing with adaptive formatting (ns โ s โ min)
- stdout/stderr capture via
Get.Redirect - CLI-style test runner with formatted terminal output
- recursive test collection across modules
๐น Architecture Overview
User Test Module
โ
โผ
JarTest.fetch()
โ
โผ
Benchmark(test_function)
โ
โโโโโโโโโโโโโโโโโ
โผ โผ
StopWatch AssertionContext
โ โ
โผ โผ
Execution AssertionResult list
โ
โผ
Result Aggregation
โ
โผ
JarTest.run()
โ
โผ
Console Reporting Layer
๐น Core Concept
The system is based on four core entities:
Benchmark
Encapsulates a test execution unit:
Benchmark(test_function)
Responsible for:
- executing test functions
- measuring execution time
- capturing exceptions and assertion failures
- storing returned values
Assertion System
Assertions are recorded during execution using a context variable:
Assertion.eq(a, b)
Assertion.neq(a, b)
Assertion.contain(a, b)
Assertion.ncontain(a, b)
Each assertion produces an AssertionResult:
| Field | Description |
|---|---|
| name | assertion type |
| passed | boolean result |
| values | input tuple |
| expected | expected value |
| actual | observed value |
| meta | operator + type metadata |
Assertions are automatically collected via AssertionContext.
JarTest
Main orchestrator:
JarTest.fetch()
JarTest.run()
Responsible for:
- discovering test functions
- wrapping them into benchmarks
- executing batches of tests
- generating structured CLI reports
Get Utility
Provides execution introspection:
- stdout/stderr capture
- subprocess execution wrapper
- controlled output redirection
๐น API / Function Documentation
๐น Assertion
| Method | Description |
|---|---|
eq |
equality check with type enforcement |
neq |
inequality check with type enforcement |
contain |
membership check |
ncontain |
non-membership check |
๐น Benchmark
| Method | Description |
|---|---|
__call__(n) |
executes test n times |
benchmark() |
static execution wrapper |
time_to_str() |
formats execution time |
๐น JarTest
| Method | Description |
|---|---|
fetch() |
discovers test functions in module |
fetch_tests() |
recursive module test collection |
run() |
executes all benchmarks with reporting |
__call__() |
fetch + run shortcut |
๐น Get
Redirect:
| Method | Description |
|---|---|
stdout() |
capture stdout + return from function |
stderr() |
capture stderr + return from function |
all_std() |
capture stdout + stderr + return |
cmd_stdout() |
run shell command (stdout + exit) |
cmd_stderr() |
run shell command (stderr + exit) |
cmd_all_std() |
run shell command (stdout + stderr + exit) |
๐น Project Structure
jarbin_toolkit_jartest/
โโโ assertion.py
โโโ benchmark.py
โโโ get.py
โโโ jartest.py
โโโ __init__.py
๐น Usage Section
๐น Defining a Test
from jarbin_toolkit_jartest import Assertion
def JT_example():
Assertion.eq(2 + 2, 4)
Assertion.contain("a", "abc")
๐น Running Tests
Auto test fetch & run
from jarbin_toolkit_jartest import JarTest
JTT_example = JarTest()
JTT_example()
๐น Capturing Output
from jarbin_toolkit_jartest import Get, Assertion
def foo():
print("bar")
def JT_example():
out, ret = Get.Redirect.stdout(foo)
Assertion.contain("bar", out, '"bar" not printed')
๐น Full test
Manual test fetch & run
from jarbin_toolkit_jartest import JarTest, Get, Assertion
def foo(message: str):
print("msg = " + message)
def JT_failing():
out, ret = Get.Redirect.stdout(foo)
Assertion.contain("...", out, 'missing argument')
def JT_valid():
out, ret = Get.Redirect.stdout(foo, "hello world")
Assertion.contain("hello world", out)
JTT_example = JarTest()
JTT_example.fetch()
JTT_example.run()
๐น Execution Behavior
- Each test runs inside a
Benchmarkwrapper - Assertions are collected via
contextvars - Execution timing is measured using
StopWatch - Exceptions are captured but do not stop reporting unless fatal
- Multiple test runs accumulate results
๐น Memory Model
-
AssertionResultobjects are stored per test execution -
Benchmarkmaintains:- time history
- error history
- assertion history
- traceback history
-
JarTestmaintains a registry of benchmarks indexed by name
No implicit global state outside controlled context variables.
๐น Design Philosophy
- deterministic execution over dynamic behavior
- structured assertion tracking instead of boolean-only tests
- explicit benchmarking integration
- modular separation of execution, assertion, and reporting
- reproducible test runs
๐น Current State
โ ๏ธ Core test execution and benchmarking system is functional
Status:
- assertion system implemented
- benchmark engine implemented
- test discovery implemented
- CLI reporting implemented
- stdout/stderr capture implemented
Limitations:
- no parallel test execution
- no test isolation sandboxing
- limited assertion set
- no fixtures system
- no mocking framework
๐น Limitations
- synchronous execution only
- no dependency injection system
- no advanced test lifecycle hooks
- no distributed execution
- console output tightly coupled to terminal UI system
๐น Extension / Contribution
Possible extensions:
- fixture system for reusable test contexts
- parallel benchmark execution
- richer assertion library
- mocking utilities
- JUnit/XML export support
- test filtering and tagging system
๐น Notes
JarTest is designed as a deterministic hybrid between testing and benchmarking, not a strict replacement for pytest.
It prioritizes:
- execution traceability
- performance measurement
- structured assertion metadata
๐น Identity Summary
Jarbin-ToolKit JarTest is:
- a deterministic test execution engine
- a structured assertion tracking system
- a benchmarking-oriented testing framework
- a lightweight test orchestration layer
๐น Final Rule
If a test behavior is not executed inside Benchmark, it is not part of the system.
Project details
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 jarbin_toolkit_jartest-0.0.1.4.tar.gz.
File metadata
- Download URL: jarbin_toolkit_jartest-0.0.1.4.tar.gz
- Upload date:
- Size: 35.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
252c1133a61f3b4856a2bfe7ff3980ad67e8caeb0413a94cd73b7824b26ac9ab
|
|
| MD5 |
4e2d2ab62d8bc1bd69acb7fa0746bf5c
|
|
| BLAKE2b-256 |
5a99962647bffc6d961a7a52bec5d864e4d98e1f37323ff07b7fcc1f915a316c
|
File details
Details for the file jarbin_toolkit_jartest-0.0.1.4-py3-none-any.whl.
File metadata
- Download URL: jarbin_toolkit_jartest-0.0.1.4-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0af274f2f8e52fce0c93de00896fbe7edd0007ebf7f53c7505b102aef235d392
|
|
| MD5 |
cb33ecdb039bb46bd9c34a34ab32d1c0
|
|
| BLAKE2b-256 |
67dcd27eca8bf46243afe2ff9d6f41135e6cf82542c670a18d9995a1da649f6f
|