Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: python unit test frame work Date: Fri, 11 Dec 2015 14:09:23 +1100 Lines: 24 Message-ID: References: <20151211004021.GA84387@cskk.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de 3YNKOd/YYFbbZ2Oxc0Kouw4NcJLuNfzEypmEc3MOsFmw== Cancel-Lock: sha1:pzXyj+mJ2nmXNvk5PReZWjDI7gg= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.046 X-Spam-Evidence: '*H*': 0.91; '*S*': 0.00; 'executed': 0.07; 'subject:test': 0.07; 'unittest': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'tends': 0.09; 'subject:python': 0.14; 'lexical': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'sequence,': 0.16; 'simpson': 0.16; 'this)': 0.16; 'test.': 0.18; 'tests': 0.18; 'first,': 0.20; 'bit': 0.23; 'module': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'earlier': 0.27; 'followed': 0.27; 'really,': 0.29; 'run': 0.33; 'on,': 0.35; "isn't": 0.35; 'unit': 0.35; 'cases': 0.36; 'subject:work': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'being': 0.37; 'received:org': 0.37; 'several': 0.38; 'test': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'your': 0.60; 'real': 0.62; 'bring': 0.62; 'back': 0.62; 'more': 0.63; 'you.': 0.64; 'cameron': 0.66; 'fit.': 0.66; 'worth': 0.67; 'skip:\xe2 10': 0.70; '8bit%:43': 0.72; 'facilities': 0.72; 'hand': 0.82; '_o__)': 0.84; 'believing': 0.84; 'observed': 0.84; 'received:125': 0.84; 'vulnerable': 0.84; 'religion': 0.91; 'hand,': 0.97 X-Injected-Via-Gmane: http://gmane.org/ 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 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:100250 Cameron Simpson writes: > First, as Ben remarks, if one test _depends_ on an earlier one then it > isn't a real unit test. > > On the other hand, if you simply have some simple tests followed by > more complex tests (I have several like this) you have two facilities > to help you. > > Firstly, I have observed that unittest tends to run tests in lexical > order Back on the first hand again, some unit test runners will deliberately *change* the order so your test cases are tested for independence. Really, if your test cases depend on being executed in a particular sequence, the ‘unittest’ module is a poor fit. -- \ “Come on, if your religion is so vulnerable that a little bit | `\ of disrespect is going to bring it down, it's not worth | _o__) believing in, frankly.” —Terry Gilliam, 2005-01-18 | Ben Finney