Skip to main content

Minimal, typed, functional and dynamic test library.

Project description

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

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

okipy-1.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

okipy-1.1.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file okipy-1.1.1.tar.gz.

File metadata

  • Download URL: okipy-1.1.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for okipy-1.1.1.tar.gz
Algorithm Hash digest
SHA256 07521aacfd68b65ee4a045256db0566e03c0455b5153ead8346fa8527304afad
MD5 03c63d2b499a05877f23721187fb218c
BLAKE2b-256 a68d07137557163687720c0cefcb4111f37ca23f972fa4d33789b3ef0814e9f7

See more details on using hashes here.

File details

Details for the file okipy-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: okipy-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for okipy-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aef34958a9027b9fe9378caf8cf42aee88d90aaba627a7b8e69ca80719d61a2b
MD5 8c4989a927d59cd840c34799bea3cf83
BLAKE2b-256 966dc02840674bd0d890cbc4e53d7f65c1a52e0909d760de15d0780e83587ecf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page