Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'test,': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; ':-)': 0.13; 'class).': 0.16; 'eckhardt': 0.16; 'finney': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:class': 0.16; 'tests': 0.18; 'header:User-Agent:1': 0.26; 'common': 0.26; 'header:X-Complaints-To:1': 0.28; 'run': 0.28; '(maybe': 0.29; 'far,': 0.29; 'wright': 0.29; 'writes:': 0.29; 'class': 0.29; 'maybe': 0.29; 'classes': 0.30; 'basic': 0.30; 'function': 0.30; 'code': 0.31; 'point': 0.31; 'to:addr:python- list': 0.33; 'ben': 0.35; 'identified': 0.35; 'moved': 0.35; 'received:org': 0.36; 'test': 0.36; 'should': 0.36; 'subject:: ': 0.38; 'easier': 0.38; 'description': 0.39; 'to:addr:python.org': 0.39; 'little': 0.39; 'header:Received:5': 0.40; 'your': 0.60; "you'll": 0.62; 'box.': 0.65; '8bit%:21': 0.69; 'kid': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ben Finney Subject: Re: unit testing class hierarchies Date: Wed, 03 Oct 2012 08:30:19 +1000 References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: rasputin.madmonks.org X-Public-Key-ID: 0xBD41714B X-Public-Key-Fingerprint: 9CFE 12B0 791A 4267 887F 520C B7AC 2E51 BD41 714B X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-gpg.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:IUuVz0IgUXuOIj+H+werguUJt8s= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349217065 news.xs4all.nl 6914 [2001:888:2000:d::a6]:55270 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30660 Ulrich Eckhardt writes: > I want test_base() to be run as part of both TestD1 and TestD2, > because it tests basic functions provided by both classes D1 and D2. It sounds, from your description so far, that you have identified a design flaw in D1 and D2. The common functionality should be moved to a common code point (maybe a base class of D1 and D2; maybe a function without need of a class). Then you'll have only one occurrence of that functionality to test, which is good design as well as easier test code :-) -- \ “When I was a little kid we had a sand box. It was a quicksand | `\ box. I was an only child... eventually.” —Steven Wright | _o__) | Ben Finney