I released Oktest.py 0.14.0. http://pypi.python.org/pypi/Oktest/ http://packages.python.org/Oktest/
Oktest.py is a new-style testing library for Python:: from oktest import ok, NG ok (x) > 0 # same as assertTrue(x > 0) ok (s) == 'foo' # same as assertEqual(s, 'foo') ok (s) != 'foo' # same as assertNotEqual(s, 'foo') ok (f).raises(ValueError) # same as assertRaises(ValueError, f) ok (u'foo').is_a(unicode) # same as assertTrue(isinstance(u'foo', unicode)) ok ('A.txt').is_file() # same as assertTrue(os.path.isfile('A.txt')) It supports WSGI Application testing:: from oktest.web import WSGITest http = WSGITest(app) resp = http.GET('/') ok (resp).is_response(200).json({"status": "OK"}) See http://packages.python.org/Oktest/ for details. New features ------------ * [enhance] Response object returned by `WSGITest#GET()' or '#POST()' now supports `body_json' property. Example:: from oktest.web import WSGITest http = WSGITest(app) resp = http.GET('/') print(resp.body_json) * [change] `headers` argument of `WSGITest#GET()' (or '#POST()' and so on) now means HTTP headers, not environ values. Example:: ## version <= 0.13 http.GET('/', headers={'HTTP_COOKIE': 'name=val'}) ## version >= 0.14 http.GET('/', headers={'Cookie': 'name=val'}) ## or http.GET('/', environ={'HTTP_COOKIE': 'name=val'}) * [enhance] (Experimental) `oktest.validator.Validator' class is added. It is convenient to test complex data structure. Example:: from oktest.validator import Validator as V ok (resp.body_json) == { "status": "OK", "member": { "name": "Haruhi", "gender": V('gender', enum=('F', 'M')), "age": V('age', type=int, between=(15, 18)), "birthday": V('created_at', pattern=r'^\d\d\d\d-\d\d-\d\d$') } } See users guide for details. http://www.kuwata-lab.com/oktest/oktest-py_users-guide.html#validator -- regars, makoto kuwata
-- https://mail.python.org/mailman/listinfo/python-list