Minimal, typed, functionnal and dynamic test library.
Find a file
2024-05-21 03:36:45 +02:00
.vscode init 2024-05-21 03:19:53 +02:00
assets fix presentation 2024-05-21 03:36:45 +02:00
example init 2024-05-21 03:19:53 +02:00
src/okipy init 2024-05-21 03:19:53 +02:00
.gitignore init 2024-05-21 03:19:53 +02:00
build.sh init 2024-05-21 03:19:53 +02:00
clean.sh init 2024-05-21 03:19:53 +02:00
LICENCE init 2024-05-21 03:19:53 +02:00
publish.sh fix presentation 2024-05-21 03:36:45 +02:00
pyproject.toml fix presentation 2024-05-21 03:36:45 +02:00
README.md fix presentation 2024-05-21 03:36:45 +02:00
setup.sh init 2024-05-21 03:19:53 +02:00

Oki.py

Minimal, typed, functional and dynamic test library.

Usage

def main():
    suite = Suite()

    @suite.test()
    def adds_correctly(ctx):
        assert 2 + 2 == 4

    @suite.test()
    def adds_incorrectly(ctx):
        print("this must work")
        assert 2 + 2 == 5

    @suite.test()
    def it_doesnt_fail(ctx):
        print("hope this doesnt fail ...")
        print("oh, this will fail", file=sys.stderr)
        raise Exception("Expected failure.")

    @suite.test()
    def it_fails(ctx):
        with ctx.assert_raises():
            raise Exception("Expected failure.")

    suite.run()

Results in this output when run :

test suite output screenshot

It is also possible to write inline tests :


def add(a, b):
    return a + b


@test()
def it_works(ctx):
    pass

test inline output screenshot