skip to navigation
skip to content

Oktest 0.11.0

a new-style testing library

Downloads ↓ | Package Documentation

Oktest 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.

 
File Type Py Version Uploaded on Size # downloads
Oktest-0.11.0-py2.4.egg (md5) Python Egg 2.4 2011-11-20 55KB 213
Oktest-0.11.0-py2.5.egg (md5) Python Egg 2.5 2011-11-20 53KB 187
Oktest-0.11.0-py2.6.egg (md5) Python Egg 2.6 2011-11-20 53KB 203
Oktest-0.11.0-py2.7.egg (md5) Python Egg 2.7 2011-11-20 53KB 270
Oktest-0.11.0-py3.0.egg (md5) Python Egg 3.0 2011-11-20 55KB 288
Oktest-0.11.0-py3.1.egg (md5) Python Egg 3.1 2011-11-20 55KB 315
Oktest-0.11.0-py3.2.egg (md5) Python Egg 3.2 2011-11-20 55KB 263
Oktest-0.11.0.tar.gz (md5) Source 2011-11-20 64KB 231