The package registry is still being built. The docs are live, everything else is a preview.

Edge Python

Sign In

Sign in to publish packages and pin them by sha256.


By continuing, you accept our Terms and Conditions.

@
Palette

test (js, cli)

test is a unit-test harness written in pure Edge Python, not a compiled plugin. Declare it with edge add test and import it by bare name. To pin a different version, point the edge.json entry at another URL, see Modules.

@fixture registers a factory under its function’s name. @test(description, *uses) registers a test and the fixtures to inject by keyword. raises(ExcType) is a context manager asserting the block raises, and it accepts a class or a tuple of classes. run() executes every registered test, prints a PASS -, FAIL -, or ERROR line per test plus a summary, and raises SystemExit(1) if anything failed, else SystemExit(0). Fixtures are flat and built fresh per test, with no scopes, autouse, or parametrization. One module-level registry holds every test, so run() executes all of them.

cmd + enter
PASS - user has a name
PASS - division by zero raises
2 passed, 0 failed
Output

Fixtures are built fresh per test, so one test cannot leak state into another:

cmd + enter
PASS - first sees an empty list
PASS - second also sees an empty list
2 passed, 0 failed
Output

A failed assertion prints a FAIL - line with the error, and run() exits nonzero:

cmd + enter
PASS - two plus two
FAIL - this one fails (AssertionError: letter missing)
1 passed, 1 failed
Output

edge test discovers *_test.py files and drives run() for you, reading the verdict from the exit code.