Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-24 Thread Robert Collins
So (wearing my maintainer hat for unittest) - very happy to consider proposals and patches; I'd very much like to fix some structural APIs in unittest, but I don't have the bandwidth to do so myself at this point. And what you're asking about is largely a structural issue because of the interaction

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-24 Thread Neil Girdhar
Makes sense. Thanks! On Thu, Aug 24, 2017 at 5:20 AM Nick Coghlan wrote: > On 24 August 2017 at 08:20, Neil Girdhar wrote: > > On Wed, Aug 23, 2017 at 3:31 AM Nick Coghlan wrote: > >> However, PEP 550's execution contexts may provide a way to track the > >> test state reliably that's independe

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-24 Thread Nick Coghlan
On 24 August 2017 at 08:20, Neil Girdhar wrote: > On Wed, Aug 23, 2017 at 3:31 AM Nick Coghlan wrote: >> However, PEP 550's execution contexts may provide a way to track the >> test state reliably that's independent of being a method on a test >> case instance, in which case it would become feasi

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-23 Thread Chris Barker
On Tue, Aug 22, 2017 at 7:05 PM, Neil Girdhar wrote: > Like you, I used nose and then switched to pytest. The reason I proposed > this for unittest is because pytest and nose and (I think) most of the > other testing frameworks inherit from unittest, > not really -- they extend unittest -- in t

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-23 Thread Neil Girdhar
On Wed, Aug 23, 2017 at 3:31 AM Nick Coghlan wrote: > On 23 August 2017 at 08:20, rym...@gmail.com wrote: > > TBH you're completely right. Every time I see someone using unittest > > andItsHorriblyUnpythonicNames, I want to kill a camel. > > > > Sometimes, though, I feel like part of the struggl

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-23 Thread Nick Coghlan
On 23 August 2017 at 08:20, rym...@gmail.com wrote: > TBH you're completely right. Every time I see someone using unittest > andItsHorriblyUnpythonicNames, I want to kill a camel. > > Sometimes, though, I feel like part of the struggle is the alternative. If > you dislike unittest, but pytest is t

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-22 Thread Neil Girdhar
Like you, I used nose and then switched to pytest. The reason I proposed this for unittest is because pytest and nose and (I think) most of the other testing frameworks inherit from unittest, so improving unittest has downstream benefits. I may nevertheless propose this to the pytest people if th

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-22 Thread Chris Barker
Getting kind of OT, but: ... pytest is too "magical" for you, > I do get confused a bit sometimes, but for the most part, I simple don't use the magic -- pytest does a great job of making the simple things simple. what do you use? Many Python testing tools like nose are just test > *runners*, s

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-22 Thread Chris Barker
On Tue, Aug 22, 2017 at 5:19 PM, Chris Barker wrote: > anyway, that's enough ranting. > Got carried away with the ranting, and didn't flesh out my point. My point is that unittest is a very static, not very pythonic framework -- if you are productive with it, great, but I don't think it's w

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-22 Thread Steven D'Aprano
On Tue, Aug 22, 2017 at 06:20:50PM -0400, rym...@gmail.com wrote: > TBH you're completely right. Every time I see someone using unittest > andItsHorriblyUnpythonicNames, I want to kill a camel. If your only complaint about unittest is that you_miss_writing_underscores_between_all_the_words, then

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-22 Thread Nick Timkovich
Knowing nothing about the JavaScript ecosystem (other than that leftpad is apparently not a joke and everything needs more jQuery), what are the leagues-above testing libraries? On Tue, Aug 22, 2017 at 5:20 PM, rym...@gmail.com wrote: > TBH you're completely right. Every time I see someone using

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-22 Thread rym...@gmail.com
TBH you're completely right. Every time I see someone using unittest andItsHorriblyUnpythonicNames, I want to kill a camel. Sometimes, though, I feel like part of the struggle is the alternative. If you dislike unittest, but pytest is too "magical" for you, what do you use? Many Python testing too

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-22 Thread Chris Barker
** Caution: cranky curmudgeonly opinionated comment ahead: ** unitest is such an ugly Java-esque static mess of an API that there's really no point in trying to clean it up and make it more pythonic -- go off and use pytest and be happier. -CHB On Tue, Aug 22, 2017 at 5:42 AM, Nick Coghlan w

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-22 Thread Nick Coghlan
On 22 August 2017 at 15:34, Nick Coghlan wrote: > On 21 August 2017 at 11:32, Neil Girdhar wrote: >> This question describes an example of the problem: >> https://stackoverflow.com/questions/8416208/in-python-is-there-a-good-idiom-for-using-context-managers-in-setup-teardown. >> You want to invok

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-21 Thread Gregory P. Smith
Neil, you might also bring this up on the http://lists.idyll.org/listinfo/testing-in-python list as I suspect people there have opinions on this topic. -gps On Mon, Aug 21, 2017 at 9:07 AM Ned Batchelder wrote: > On 8/20/17 9:32 PM, Neil Girdhar wrote: > > This question describes an example of

Re: [Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-21 Thread Ned Batchelder
On 8/20/17 9:32 PM, Neil Girdhar wrote: > This question describes an example of the > problem: > https://stackoverflow.com/questions/8416208/in-python-is-there-a-good-idiom-for-using-context-managers-in-setup-teardown. > You want to invoke a context manager in your setup/tearing-down, but > the e

[Python-ideas] Please consider adding context manager versions of setUp/tearDown to unittest.TestCase

2017-08-20 Thread Neil Girdhar
This question describes an example of the problem: https://stackoverflow.com/questions/8416208/in-python-is-there-a-good-idiom-for-using-context-managers-in-setup-teardown. You want to invoke a context manager in your setup/tearing-down, but the easiest way to do that is to override run, whic