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

2013-08-11 Thread adam . preble
On Friday, August 9, 2013 1:31:43 AM UTC-5, Peter Otten wrote: > I see I have to fix it myself then... Sorry man, I think in my excitement of seeing the first of your examples to work, that I missed the second example, only seeing your comments about it at the end of the post. I didn't expect s

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

2013-08-08 Thread Peter Otten
adam.pre...@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... > > Interesting, I got __main__.T, even though I pretty much just t

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

2013-08-08 Thread adam . preble
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... Interesting, I got __main__.T, even though I pretty much just tried your code wholesale. For what it's

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

2013-08-08 Thread Terry Reedy
On 8/8/2013 12:20 PM, adam.pre...@gmail.com wrote: On Thursday, August 8, 2013 3:04:30 AM UTC-5, Terry Reedy wrote: def test(f): f.__class__.__dict__['test_'+f.__name__] Sorry, f.__class__ is 'function', not the enclosing class. A decorator for a method could not get the enclosing cl

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

2013-08-08 Thread Ned Batchelder
On 8/8/13 12:17 PM, adam.pre...@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 w

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

2013-08-08 Thread adam . preble
On Thursday, August 8, 2013 3:04:30 AM UTC-5, Terry Reedy wrote: > I cannot help but note that this is *more* typing. But anyhow, something It wasn't so much about the typing so much as having "test" in front of everything. It's a problem particular to me since I'm writing code that, well, run

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

2013-08-08 Thread adam . preble
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 alternativ

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

2013-08-08 Thread Peter Otten
Peter Otten wrote: > $ python3 mytestcase_demo.py -v > test_one (__main__.test_two) ... ok > test_two (__main__.test_two) ... ok > > -- > Ran 2 tests in 0.000s Oops, that's an odd class name. Fixing the name clash in Types.__new

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

2013-08-08 Thread Peter Otten
adam.pre...@gmail.com wrote: > We were coming into Python's unittest module from backgrounds in nunit, > where they use a decorate to identify tests. So I was hoping to avoid the > convention of prepending "test" to the TestClass methods that are to be > actually run. I'm sure this comes up all

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

2013-08-08 Thread Terry Reedy
On 8/8/2013 2:32 AM, adam.pre...@gmail.com wrote: We were coming into Python's unittest module from backgrounds in nunit, where they use a decorate to identify tests. So I was hoping to avoid the convention of prepending "test" to the TestClass methods that are to be actually run. I'm sure th

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

2013-08-07 Thread adam . preble
We were coming into Python's unittest module from backgrounds in nunit, where they use a decorate to identify tests. So I was hoping to avoid the convention of prepending "test" to the TestClass methods that are to be actually run. I'm sure this comes up all the time, but I mean not to have to