[ANN] Oktest.py 0.12.0 released - a new-style testing library

Makoto Kuwata kwa at kuwata-lab.com
Sun Jan 12 07:38:07 EST 2014


Hi,

I released Oktest 0.12.0.
https://pypi.python.org/pypi/Oktest/

Oktest is a new-style testing library for Python.

    ## unittest
    self.assertEqual(x, y)
    self.assertNotEqual(x, y)
    self.assertGreaterEqual(x, y)
    self.assertIsInstance(obj, cls)
    self.assertRegexpMatches(text, rexp)

    ## Oktest.py
    ok (x) == y
    ok (x) != y
    ok (x) >= y
    ok (obj).is_a(cls)
    ok (text).match(rexp)


Install
  $ easy_install oktest

User's Guide
  http://www.kuwata-lab.com/oktest/oktest-py_users-guide.html

Changes
  http://www.kuwata-lab.com/oktest/oktest-py_CHANGES.txt


Highlight on this release
-------------------------

This release contains new and important enhancements.

* [enhance] `ok (actual) == expected' reports unified diff.
  Example::

    AssertionError:
    --- expected
    +++ actual
    @@ -1,3 +1,3 @@
     {'email': 'haruhi at sos-brigade.org',
    - 'gender': 'Female',
    + 'gender': 'female',
      'username': 'Haruhi'}

* [enhance] @at_end decorator registers callback which is called
  at end of test case. ::

      @test("example to remove temporary file automatically")
      def _(self):
        ## create dummy file
        with open('dummy.txt', 'w') as f:
          f.write("blablabla")
        ## register callback to delete dummy file at end of test case
        @at_end
        def _():
          os.unlink(tmpfile)
        ## do test
        with open(tmpfile) as f:
          ok (f.read()) == "blablabla"

* [enhance] New assertions for WebOb/Werkzeug response object. ::

     ok (resp).is_response(200)                          # status code
     ok (resp).is_response((302, 303))                   # status code
     ok (resp).is_response('200 OK')                     # status line
     ok (resp).is_response(200, 'image/jpeg')            # content-type
     ok (resp).is_response(200, re.compile(r'^image/(jpeg|png|gif)$'))
     ok (resp).is_response(302).header("Location", "/")  # header
     ok (resp).is_response(200).json({"status": "OK"})   # json data
     ok (resp).is_response(200).body("<h1>Hello</h1>")   # response body
     ok (resp).is_response(200).body(re.compile("<h1>.*?</h1>"))

* [bugfix] @todo decorator now supports fixture injection. ::

     @test('example')
     @todo             # error on previous version but not on this release
     def _(self, x):
         assert False


You can see all enhancements and changes. See
  http://www.kuwata-lab.com/oktest/oktest-py_CHANGES.txt


Have fun!

--
regards,
makoto kuwata
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140112/4a37d10f/attachment.html>


More information about the Python-list mailing list