Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95076
| Path | csiph.com!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; '(python': 0.05; 'classes,': 0.05; '[0]': 0.07; 'classes.': 0.07; 'performs': 0.07; 'api': 0.09; 'doubles': 0.09; 'higher-level': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:library': 0.09; 'python': 0.10; 'api,': 0.16; 'inability': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'stubs,': 0.16; 'later': 0.16; 'case.': 0.18; 'all,': 0.20; 'library': 0.20; 'libraries': 0.22; 'testing': 0.25; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'specifically': 0.28; 'behaviour': 0.29; "i'm": 0.30; 'classes': 0.30; 'code': 0.30; 'http': 0.33; 'i.e.': 0.35; 'interact': 0.35; 'library.': 0.35; 'level': 0.35; 'but': 0.36; 'instead': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'received:org': 0.37; 'test': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'easy': 0.60; 'term': 0.60; 'provide': 0.61; 'real': 0.62; 'more': 0.63; 'url:%20': 0.63; 'numerous': 0.66; '8bit%:21': 0.70; 'skip:\xe2 10': 0.70; '8bit%:46': 0.76; '_o__)': 0.84; 'correlate': 0.84; 'received:125': 0.84; 'subject:Test': 0.84; 'on?': 0.91; 'skip:\xe2 30': 0.91; '8bit%:18': 0.93; 'philips': 0.93; '\xe2\x80\x9cthe': 0.93 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Ben Finney <ben+python@benfinney.id.au> |
| Subject | Test doubles for Python standard library HTTP classes |
| Date | Thu, 06 Aug 2015 18:32:56 +1000 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | jigong.madmonks.org |
| X-Public-Key-ID | 0xAC128405 |
| X-Public-Key-Fingerprint | 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 |
| X-Public-Key-URL | http://www.benfinney.id.au/contact/bfinney-pubkey.asc |
| X-Post-From | Ben Finney <bignose+hates-spam@benfinney.id.au> |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
| Cancel-Lock | sha1:FzynKFGz9TjNjP89rIKkoLKDP+8= |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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.1272.1438849997.3674.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1438849997 news.xs4all.nl 2856 [2001:888:2000:d::a6]:58548 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:95076 |
Show key headers only | View raw
Howdy all, What standard Python library is there to make test doubles of ‘httplib.HTTPConnection’ and ‘urllib2.HTTPBasicAuthHandler’ and so on? I have a code base (Python 2 code) which performs HTTP sessions using the various HTTP-level classes in the standard library. Testing this code will be made much easier if I can create numerous test doubles[0] with pre-determined behaviour and instrumentation for later inspection, to allow the functions I'm testing to interact with those doubles instead of the real thing. There are some libraries that provide a much higher-level API, but I need to provide double behaviour at the level this code expects, i.e. at the level of the API provided by ‘httplib’ and ‘urllib2’ classes. What standard code libraries provide classes which make it easy to double the behaviour of ‘httplib’ classes and ‘urllib2’ classes, etc. for test cases? [0] Test double <URL:http://xunitpatterns.com/Test%20Double.html> is a more general term covering all of stubs, fakes, spies, mocks, etc. to double specifically as a fixture in a test case. -- \ “The most merciful thing in the world… is the inability of the | `\ human mind to correlate all its contents.” —Howard Philips | _o__) Lovecraft | Ben Finney
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Test doubles for Python standard library HTTP classes Ben Finney <ben+python@benfinney.id.au> - 2015-08-06 18:32 +1000
csiph-web