Skip to main content

Oktest.py is a new-style testing library for Python.

from oktest import test, ok, NG

class FooTest(unittest.TestCase):

   @test("1 + 1 should be 2")
   def _(self):
      ok (1+1) == 2          # same as assertEqual(2, 1+1)

   @test("other examples")
   def _(self):
      ok (s) == 'foo'        # same as assertEqual(s, 'foo')
      ok (s) != 'foo'        # same as assertNotEqual(s, 'foo')
      ok (n) > 0             # same as assertTrue(n > 0)
      ok (fn).raises(Error)  # same as assertRaises(Error, fn)
      ok ([]).is_a(list)     # same as assertTrue(isinstance([], list))
      NG ([]).is_a(tuple)    # same as assertTrue(not isinstance([], tuple))
      ok ('A.txt').is_file() # same as assertTrue(os.path.isfile('A.txt'))
      NG ('A.txt').is_dir()  # same as assertTrue(not os.path.isdir('A.txt'))

Features:

  • ok() is provided which is much shorter than self.assertXxxx().

  • Allow to write test name in free text.

  • Fixture injection support.

  • Tracer class is provided which can be used as mock or stub.

  • Text diff (diff -u) is displayed when texts are different.

Oktest requires Python 2.4 or later (3.x is supported).

See User’s Guide and CHANGES.txt for details.

Metadata

Release files for Oktest 0.15.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Oktest 0.15.2
File Size Uploaded Provenance
Oktest-0.15.2.tar.gz 97.8 kB Without provenance Details

Release files / Oktest-0.15.2.tar.gz

Download URL Oktest-0.15.2.tar.gz
Size 97.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5520c5ceb7a8e0d5fd7422e1a03580657849aee06ef8a85b03744e761d0751b5
BLAKE2b-256 checksum
How to use checksums
83fa7be008edf000279b642fbb09695a50b8258a8c1549852e6ee4cf22006b09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for Oktest 0.15.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page