Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'classes,': 0.05; 'assign': 0.07; 'attribute': 0.07; 'odd': 0.07; 'tests.': 0.07; 'decorator': 0.09; 'subject:method': 0.09; 'unittest': 0.09; 'cc:addr:python- list': 0.11; 'attribute,': 0.16; 'experiments': 0.16; 'responses.': 0.16; 'subject: \n ': 0.16; 'subject:make': 0.16; 'subject:possible': 0.16; 'thursday,': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'tests': 0.22; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'fixing': 0.31; 'class': 0.32; 'run': 0.32; 'another': 0.32; 'subject:from': 0.34; 'could': 0.34; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'grateful': 0.36; 'example,': 0.37; 'pm,': 0.38; 'subject:" ': 0.39; 'august': 0.61; 'simply': 0.61; 'email addr:gmail.com': 0.63; 'name': 0.63; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'alternative.': 0.84; 'everything.': 0.84; 'otten': 0.84; 'viable': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=a5yQN8YovAAEQLwGvmp8/8p1tUe5ZUaf8la+2D7YBok=; b=fQ/vKyB0YazCNQZFE2RJL0Ogyx5d1el15sqco0HE9J1EonSkDPqcFALF7FdoVG3mPY +XYpmp/Opy/qerSHnlfJm2WMiNSTIo4LrQuPeaEGNkrySFDSmXZgRGvuecBgOJ4uR+2i rzTdRV72Lek44Xxr5c67OM86M948kQB0IDI3pgnopoOhJpHAfRapIIwLwT4crs+Wgz3S 6qrbJ3SDZLBzJYpXAepoS85LkUwnn4YR9ilcfhzGNTxQXUHa13pNML21fDiBcS/W0ToF mn8anORnphozKoRFrbSW85nRL4maUOaRI44eWzsrlvXIZtp6kXxPQfY/M7T/9bttBkaf +NuA== X-Received: by 10.49.129.228 with SMTP id nz4mr6981368qeb.77.1375982078130; Thu, 08 Aug 2013 10:14:38 -0700 (PDT) Sender: Ned Batchelder Date: Thu, 08 Aug 2013 13:14:37 -0400 From: Ned Batchelder User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: adam.preble@gmail.com Subject: Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?" References: <215331fa-379f-4251-b722-44555349fbb5@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Thu, 08 Aug 2013 19:28:05 +0200 Cc: python-list@python.org 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1375982886 news.xs4all.nl 15866 [2001:888:2000:d::a6]:49841 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:52214 On 8/8/13 12:17 PM, adam.preble@gmail.com wrote: > On Thursday, August 8, 2013 3:50:47 AM UTC-5, Peter Otten wrote: >> Peter Otten wrote: >> Oops, that's an odd class name. Fixing the name clash in Types.__new__() is >> >> left as an exercise... > I will do some experiments with a custom test loader since I wasn't aware of that as a viable alternative. I am grateful for the responses. If you can use another test runner, they often have more flexible and powerful ways to do everything. nosetests will let you use a __test__ attribute, for example, to mark tests. Your decorator could simply assign that attribute on the test methods. You'd still write your tests using the unittest base classes, but run them with nose. --Ned.