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.2.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

okipy-1.2.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: okipy-1.2.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for okipy-1.2.0.tar.gz
Algorithm Hash digest
SHA256 491ac47d33638c9a20db6731c22c6ef926f78938020c7e9d6da71cc24cc03c2e
MD5 2dfd5596fd72499012d4085f38dd42d9
BLAKE2b-256 488319960c6464ca7ab796006c0d0d52ded0ea710b1c3ed5947ce3c42fffb52b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: okipy-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for okipy-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c52aecd8f5905337571879e0ed5d8b6e57a7f966daa5f2253db579dc867f022
MD5 061d987081109a85a1fca1d68311aec5
BLAKE2b-256 bd7576f2bad9ce585aec1c2db1614a7ace97878268b35355ba0d0292646ef2df

See more details on using hashes here.

Supported by

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