Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #64546

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <kwatch@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'url:pypi': 0.03; 'skip:[ 20': 0.04; 'subject:ANN': 0.07; 'test,': 0.07; '__name__': 0.09; 'bytes,': 0.09; 'http': 0.09; 'resp': 0.09; 'unittest': 0.09; 'def': 0.12; 'changes': 0.15; "'200": 0.16; "'__main__':": 0.16; 'easy_install': 0.16; 'headers,': 0.16; 'https': 0.16; 'new-style': 0.16; 'skip:[ 40': 0.16; 'subject:library': 0.16; 'url:example': 0.16; 'wsgi': 0.16; 'sender:addr:gmail.com': 0.17; 'library': 0.18; 'app': 0.19; 'module': 0.19; 'subject:] ': 0.20; '8bit%:5': 0.22; 'import': 0.22; 'install': 0.23; 'headers': 0.24; 'skip:` 20': 0.24; 'unicode': 0.24; '----------': 0.26; 'testing': 0.29; 'skip:( 40': 0.30; 'skip:@ 10': 0.30; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'requests': 0.31; 'assert': 0.31; 'skip:( 50': 0.31; 'testing.': 0.31; "user's": 0.31; 'class': 0.32; 'url:python': 0.33; 'skip:_ 10': 0.34; 'skip:s 30': 0.35; 'test': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'possible': 0.36; 'url:org': 0.36; 'application': 0.37; 'subject:new': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'skip:& 20': 0.39; 'subject:[': 0.39; 'to:addr:python.org': 0.39; '8bit%:6': 0.40; 'new': 0.61; 'skip:n 10': 0.64; 'messaging': 0.68; 'subject': 0.69
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=AJU/++wL4L7d478Ng3SzK93xN61ZKYd/DudkH1NkVgM=; b=IJbnA1JhCq0YIqFNeult1tUhXnP4N8Kog9EtPecmyp4/x/LOabrnlUUJt49B8ardpc 4qGb8dIbhoupzZGVNiR0s9zaQkvyqh4UubAiEy0NtQmU5epOg0ZhqM9J+tGyydAlDEld NguO8U5W71UlqYaRA53i7TBV1cJCUWEdiWUtg0QA8PzzfWaUfRtm0HS7bC1wosSws6Ed tPh6K4814HFVo6y1S7Oq1TsB0ceK2B4CR/Cdlk20ATvR6El4GFJy5e+NoAKHufenTBFR 7r8lNT6uK07MIN88qK6WDxAIHxq8sHV3By+/LfzEkajjShJA9MTjAJUMt6ceaxaXvP6s GvAQ==
MIME-Version 1.0
X-Received by 10.229.194.1 with SMTP id dw1mr7473252qcb.20.1390439692732; Wed, 22 Jan 2014 17:14:52 -0800 (PST)
Sender kwatch@gmail.com
Date Thu, 23 Jan 2014 10:14:52 +0900
X-Google-Sender-Auth nKJoGg5by5gTriUM0FiDrsun_fk
Subject [ANN] Oktest.py 0.13.0 - a new style testing library
From Makoto Kuwata <kwa@kuwata-lab.com>
To python-list@python.org
Content-Type multipart/alternative; boundary=001a11c2c736f795d104f098f7de
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5854.1390439699.18130.python-list@python.org> (permalink)
Lines 165
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1390439699 news.xs4all.nl 2864 [2001:888:2000:d::a6]:52718
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:64546

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Oktest 0.13.0 is released.
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)

It is possible to assert WebOb/Werkzeug/Requests response object easily.

    ok (response).is_response(200).json({"status":"OK"})


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


What's New
----------

* [enhance] `ok().is_response()' now supports Requests.
  Example::

      import requests
      resp = requests.get('http://www.example.com/')
      ok (resp).is_response(200, 'text/html')

* [enhance] (Experimental) Add 'oktest.web' module to help WSGI app testing.
  Example::

      ## create WSGI application
      class App(object):
          def __call__(self, environ, start_response):
              status  = '200 OK'
              headers = [('Content-Type', 'application/json')]
              body    = [b'''{"message":"Hello!"}''']  # bytes, not unicode
              start_response(status, headers)
              return body

      app = App()

      ## test for app
      import unittest
      import oktest
      from oktest import test, ok, subject
      from oktest.web import WSGITest           # !!!!!

      http  = WSGITest(app)                     # !!!!!
      https = WSGITest(app, {'HTTPS': 'on'})    # !!!!!

      class AppTest(unittest.TestCase):

          with subject('GET /'):

              @test("Returns messaging JSON.")
              def _(self):
                  resp = http.GET('/')     # or http('GET', '/')
                  ok (resp).is_response(200).json({"message": "Hello!"})
                  ## or
                  status, headers, body = http.GET('/')   # or http('GET',
'/')
                  ok (status)  == '200 OK'
                  ok (headers) == [('Content-Type', 'application/json')]
                  ok (body)    == [b'''{"message":"Hello!"}''']

      if __name__ == '__main__':
          oktest.main()


--
regars,
makoto kuwata

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

[ANN] Oktest.py 0.13.0 - a new style testing library Makoto Kuwata <kwa@kuwata-lab.com> - 2014-01-23 10:14 +0900

csiph-web