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?"

Date 2013-08-08 13:14 -0400
From Ned Batchelder <ned@nedbatchelder.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>
Newsgroups comp.lang.python
Message-ID <mailman.363.1375982886.1251.python-list@python.org> (permalink)

Show all headers | 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