Skip to main content
error loading Epitech Logo error loading Jarbin-ToolKit Logo

📦 Jarbin-ToolKit:JarTest v0.2.2.1

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 Benchmark wrapper
  • 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

  • AssertionResult objects are stored per test execution

  • Benchmark maintains:

    • time history
    • error history
    • assertion history
    • traceback history
  • JarTest maintains 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.


Metadata

Release files for jarbin-toolkit-jartest 0.2.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jarbin-toolkit-jartest 0.2.2.1
File Size Uploaded Provenance Actions
jarbin_toolkit_jartest-0.2.2.1.tar.gz 42.8 kB Without provenance Details for jarbin_toolkit_jartest-0.2.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jarbin-toolkit-jartest 0.2.2.1
File Interpreter ABI Platform Actions
jarbin_toolkit_jartest-0.2.2.1-py3-none-any.whl Python 3 none any Details for jarbin_toolkit_jartest-0.2.2.1-py3-none-any.whl

Total release size: 74.8 kB

Release files / jarbin_toolkit_jartest-0.2.2.1.tar.gz

Download URL jarbin_toolkit_jartest-0.2.2.1.tar.gz
Size 42.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8f3b94936d5b234a72311e8d25dcb8ac3653fd5f66989d05a271d499c218b635
BLAKE2b-256 checksum
How to use checksums
80188d9c92d1a572c6155705ca6039c0859ba82ca06d2b0e2cc570efc77c32aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / jarbin_toolkit_jartest-0.2.2.1-py3-none-any.whl

Download URL jarbin_toolkit_jartest-0.2.2.1-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fc842978276afe696fa64acc7bd8c927f5d50c4156a96ea2e6e1df626fb8589
BLAKE2b-256 checksum
How to use checksums
f5ad8c88a8585611d8ac5e0d0d7a2684a6382e74c210415a69c8dbc702aecac6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for jarbin-toolkit-jartest 0.2.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page