Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52214

Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?"

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 <nedbat@gmail.com>
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 <nedbat@gmail.com>
Date Thu, 08 Aug 2013 13:14:37 -0400
From Ned Batchelder <ned@nedbatchelder.com>
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> <ktvl3d$vr9$1@ger.gmane.org> <mailman.343.1375951856.1251.python-list@python.org> <c85e5960-f1ed-4e93-9031-60d25519ad14@googlegroups.com>
In-Reply-To <c85e5960-f1ed-4e93-9031-60d25519ad14@googlegroups.com>
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 <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.363.1375982886.1251.python-list@python.org> (permalink)
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

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Is it possible to make a unittest decorator to rename a method from "x" to "testx?" adam.preble@gmail.com - 2013-08-07 23:32 -0700
  Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?" Terry Reedy <tjreedy@udel.edu> - 2013-08-08 04:04 -0400
    Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?" adam.preble@gmail.com - 2013-08-08 09:20 -0700
      Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?" Terry Reedy <tjreedy@udel.edu> - 2013-08-08 15:28 -0400
  Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?" Peter Otten <__peter__@web.de> - 2013-08-08 10:32 +0200
  Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?" Peter Otten <__peter__@web.de> - 2013-08-08 10:50 +0200
    Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?" adam.preble@gmail.com - 2013-08-08 09:17 -0700
      Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?" Ned Batchelder <ned@nedbatchelder.com> - 2013-08-08 13:14 -0400
    Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?" adam.preble@gmail.com - 2013-08-08 22:07 -0700
      Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?" Peter Otten <__peter__@web.de> - 2013-08-09 08:31 +0200
        Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?" adam.preble@gmail.com - 2013-08-11 21:25 -0700

csiph-web