Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30634
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <thbach@students.uni-mainz.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.078 |
| X-Spam-Evidence | '*H*': 0.84; '*S*': 0.00; 'def': 0.10; 'eckhardt': 0.16; 'help?': 0.16; 'oct': 0.16; 'redundant,': 0.16; 'subject:class': 0.16; 'wrote:': 0.17; 'test.': 0.17; 'runs': 0.22; 'idea': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'see,': 0.27; 'run': 0.28; 'skip:_ 10': 0.29; 'class': 0.29; 'code': 0.31; 'received:84': 0.32; 'could': 0.32; '+0200,': 0.33; 'to:addr:python-list': 0.33; 'method': 0.36; 'test': 0.36; 'charset:us-ascii': 0.36; 'does': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'received:10': 0.38; 'to:addr:python.org': 0.39; 'content-disposition:inline': 0.60; 'thomas': 0.62; 'provide': 0.62; 'more': 0.63; 'sounds': 0.71; "'test'": 0.84; 'received:10.94': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=uni-mainz.de; i=@uni-mainz.de; q=dns/txt; s=ironport; t=1349186875; x=1380722875; h=date:from:to:subject:message-id:references:mime-version: in-reply-to; bh=FIv8Yl7OkIrNp6LwBKAsy7uby9B08OrKcghy9DH7Ar0=; b=kAgxc6nXU+TVFwHFEbkWS382huANLm6hTkyRUIm/IjZ3mmp157jzx2d2 SC5id4wvcaB5/nq1FJv5mT3p8J04aTPEqEHDECCDc0mn884YYzz8RqJG3 v2XSLWvIzLTOH2sLPJRc/rY3wNi2Q54x0nfO26OePqZPOC53W2uuxLmHx I=; |
| X-IronPort-Anti-Spam-Filtered | true |
| X-IronPort-Anti-Spam-Result | ApwEAPzzalAKXgZY/2dsb2JhbABFv2KCIAEBBTpPCxgeEBQpIIgcqHKQZ4sagyuCQGADlWgBkCuCaYIV |
| Date | Tue, 2 Oct 2012 16:06:38 +0200 |
| From | Thomas Bach <thbach@students.uni-mainz.de> |
| To | <python-list@python.org> |
| Subject | Re: unit testing class hierarchies |
| References | <v53rj9-5kd.ln1@satorlaser.homedns.org> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset="us-ascii" |
| Content-Disposition | inline |
| In-Reply-To | <v53rj9-5kd.ln1@satorlaser.homedns.org> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| X-Originating-IP | [84.59.161.216] |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1725.1349186875.27098.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1349186875 news.xs4all.nl 6859 [2001:888:2000:d::a6]:34500 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:30634 |
Show key headers only | View raw
On Tue, Oct 02, 2012 at 02:27:11PM +0200, Ulrich Eckhardt wrote: > As you see, the code for test_base() is redundant, so the idea is to > move it to a baseclass: > > class TestBase(unittest.TestCase): > def test_base(self): > ... > > class TestD1(TestBase): > def test_r(self): > ... > def test_s(self): > ... > > class TestD2(TestBase): > def test_x(self): > ... > def test_y(self): > ... Could you provide more background? How do you avoid that test_base() runs in TestD1 or TestD2? To me it sounds like test_base() is actually no test. Hence, I would rather give it a catchy name like _build_base_cls(). If a method name does not start with 'test' it is not considered a test to run automatically. Does this help? Regards, Thomas Bach.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
unit testing class hierarchies Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-10-02 14:27 +0200
Re: unit testing class hierarchies Demian Brecht <demianbrecht@gmail.com> - 2012-10-02 07:05 -0700
Re: unit testing class hierarchies Thomas Bach <thbach@students.uni-mainz.de> - 2012-10-02 16:06 +0200
Re: unit testing class hierarchies Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-10-02 17:24 +0200
Re: unit testing class hierarchies Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-10-02 18:54 +0200
Re: unit testing class hierarchies Peter Otten <__peter__@web.de> - 2012-10-02 19:38 +0200
Re: unit testing class hierarchies Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-02 19:41 +0100
Re: unit testing class hierarchies Ben Finney <ben+python@benfinney.id.au> - 2012-10-03 08:30 +1000
Re: unit testing class hierarchies Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-03 01:20 +0000
Re: unit testing class hierarchies Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-10-03 10:33 +0100
Re: unit testing class hierarchies Terry Reedy <tjreedy@udel.edu> - 2012-10-03 16:14 -0400
Re: unit testing class hierarchies Peter Otten <__peter__@web.de> - 2012-10-02 16:32 +0200
Re: unit testing class hierarchies Fayaz Yusuf Khan <fayaz@dexetra.com> - 2012-10-02 20:35 +0530
Re: unit testing class hierarchies Peter Otten <__peter__@web.de> - 2012-10-02 19:40 +0200
Re: unit testing class hierarchies Roy Smith <roy@panix.com> - 2012-10-02 19:46 -0400
csiph-web