Edge Python
Esc

Go to

Commands

Sign In

Sign in to publish packages and pin them by sha256.


By continuing, you accept our Terms and Conditions.

@
Palette

test

0.1.0

Fixtures, assertions and a runner for Edge Python tests.

@dylan·0 downloads·5.9 KB·needs edge 0.7.3·Repository
edge add test && edge lock
bash

sha256-a2101fa8d40862c187b67251c6ba97a650db7dfadb7da2276f23efc6dd4feda9

Docs

test

test is a unit-test harness written in Edge Python. Tests register with decorators, fixtures are injected by keyword, and run() reports each test and exits with a code a runner can read.

pass. user has a name
pass. division by zero raises
2 passed, 0 failed
Output

@fixture registers a factory under its function’s name. Every test that names it gets a fresh one, so no test leaks state into another. @test(description, *uses) registers a test and the fixtures it takes.

raises(exc_type, match=None) asserts that the block raises exc_type, a class or a tuple of classes. With match the message must also contain that text, so the right exception raised for the wrong reason still fails.

pass. rejects negatives
1 passed, 0 failed
Output

run() prints a pass., fail. or error. line per test and a summary, then raises SystemExit(1) if anything failed and SystemExit(0) otherwise. A failed assertion carries its message.

pass. two plus two
fail. this one fails (AssertionError: letter missing)
1 passed, 1 failed
Output

edge test finds every *_test.py file and reads each verdict from that exit code.

Versions

VersionPublishedSize
0.1.0currentSeptember 28, 20265.9 KB