Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-08 Thread Jonathan Lange
On Tue, Nov 8, 2011 at 5:44 AM, Glyph Lefkowitz wrote: > >> On Nov 7, 2011, at 10:25 AM, exar...@twistedmatrix.com wrote: >> >>> reactor = getUtility(IReactor)? > >> That's not really a solution.  It's the barest glimpse of a large system >> which might be applied as a solution.  Do you want to ex

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-07 Thread Glyph Lefkowitz
On Nov 7, 2011, at 10:25 AM, exar...@twistedmatrix.com wrote: >> reactor = getUtility(IReactor)? > > That's not really a solution. It's the barest glimpse of a large system > which might be applied as a solution. Do you want to expand it? I'd like to echo this request for exposition. My und

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-07 Thread exarkun
On 06:06 pm, j...@mumak.net wrote: On Tue, Nov 1, 2011 at 6:48 PM, Glyph wrote: On Nov 1, 2011, at 12:14 PM, Phil Mayers wrote: On 01/11/11 15:28, Christopher Armstrong wrote: I whole-heartedly agree with the sentiment, though. We need to get rid of the global reactor. Why? Sometimes you

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-07 Thread Jonathan Lange
On Tue, Nov 1, 2011 at 6:48 PM, Glyph wrote: > On Nov 1, 2011, at 12:14 PM, Phil Mayers wrote: > >> On 01/11/11 15:28, Christopher Armstrong wrote: >> >>> I whole-heartedly agree with the sentiment, though. We need to get rid >>> of the global reactor. >> >> Why? > > Sometimes you want a different

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-03 Thread Glyph
On Nov 3, 2011, at 5:14 AM, Phil Mayers wrote: > On 11/02/2011 10:56 PM, Glyph Lefkowitz wrote: >> >> On Nov 2, 2011, at 3:55 AM, Phil Mayers wrote: >> >>> But I'll note that most people I've seen crib from existing test code >>> during the early phases of TDD, tutorials or not - and if most te

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-03 Thread Phil Mayers
On 11/02/2011 10:56 PM, Glyph Lefkowitz wrote: > > On Nov 2, 2011, at 3:55 AM, Phil Mayers wrote: > >> But I'll note that most people I've seen crib from existing test code >> during the early phases of TDD, tutorials or not - and if most test code >> in Twisted uses the real reactor... > > Thanks

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-02 Thread Glyph Lefkowitz
On Nov 2, 2011, at 3:55 AM, Phil Mayers wrote: > But I'll note that most people I've seen crib from existing test code > during the early phases of TDD, tutorials or not - and if most test code > in Twisted uses the real reactor... Thanks for volunteering to fix some of our existing tests, the

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-02 Thread Phil Mayers
On 11/02/2011 07:55 AM, Phil Mayers wrote: > Without commenting on everything else in the thread s/thread/message/ Dammit... ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-pyt

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-02 Thread Phil Mayers
On 11/01/2011 11:49 PM, Glyph wrote: > of "real" reactors. New contributors sometimes say that they don't feel > like the code is "really" being tested unless they're testing against > the real implementation of something, and it may not be immediately > obvious that testing against a not-real imp

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Glyph
On Nov 1, 2011, at 10:20 PM, Tim Allen wrote: > On Tue, Nov 01, 2011 at 02:48:02PM -0400, Glyph wrote: >> If you can think of a better solution that addresses all of these >> concerns simultaneously somehow, please share, I'd love to hear it >> :-). > > I'm not sure if it addresses all your conc

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Tim Allen
On Tue, Nov 01, 2011 at 02:48:02PM -0400, Glyph wrote: > If you can think of a better solution that addresses all of these > concerns simultaneously somehow, please share, I'd love to hear it > :-). I'm not sure if it addresses all your concerns, but twisted.python.context will let you set a parti

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Glyph
On Nov 1, 2011, at 4:36 PM, Phil Mayers wrote: > One example, we use a tiny script wrapping DeferredSemaphore and > t.p.utils.getProcessOutput to parallelise SSH scanning, because > ssh-keyscan is (ahem) poorly implemented. > > Maybe I knock up more of these short 20-liners than is common? And

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Glyph
On Nov 1, 2011, at 10:38 AM, exar...@twistedmatrix.com wrote: > Hello, > > I'd like for us to decide that we will introduce no new unit tests into > Twisted's test suite which use the global reactor. +1. Let's add this to the coding standard. It doesn't look to me like anyone's objecting.

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread exarkun
On 09:37 pm, ra...@twistedmatrix.com wrote: >On Tue, Nov 1, 2011 at 5:29 PM, Anton Gyllenberg wrote: >>On Tue, Nov 1, 2011 at 20:48, Glyph wrote: >> > On Nov 1, 2011, at 12:14 PM, Phil Mayers wrote: >> >> I find the "pass reactor as 1st argument to everything" API pattern >> >> messy. I'm sure th

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Christopher Armstrong
On Tue, Nov 1, 2011 at 5:29 PM, Anton Gyllenberg wrote: > On Tue, Nov 1, 2011 at 20:48, Glyph wrote: > > On Nov 1, 2011, at 12:14 PM, Phil Mayers wrote: > >> I find the "pass reactor as 1st argument to everything" API pattern > >> messy. I'm sure there's a good reason. What is it? > > > > This p

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Anton Gyllenberg
On Tue, Nov 1, 2011 at 20:48, Glyph wrote: > On Nov 1, 2011, at 12:14 PM, Phil Mayers wrote: >> I find the "pass reactor as 1st argument to everything" API pattern >> messy. I'm sure there's a good reason. What is it? > > This pattern is a solution to the problem, but I agree that it is possibly

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Phil Mayers
On 11/01/2011 06:48 PM, Glyph wrote: > Nevertheless, "real reactor as default argument" is not a huge > improvement either, because it typically breaks one level out. If > you have 'a(reactor=defaultReactor)' and then 'b()' needs to call > 'a', half the time 'b' will forget to supply a reactor ar

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Phil Mayers
On 11/01/2011 07:51 PM, Jonathan Lange wrote: > Sorry, I thought you were asking us to come up with good reasons for > why you find it messy. Drat; upon re-reading my question, that meaning does suggest itself, doesn't it? Oh well, never mind. I blame email... __

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Jonathan Lange
On Tue, Nov 1, 2011 at 12:45 PM, Phil Mayers wrote: > On 01/11/11 16:18, Jonathan Lange wrote: >> On Tue, Nov 1, 2011 at 12:14 PM, Phil Mayers  wrote: >>> On 01/11/11 15:28, Christopher Armstrong wrote: >>> I whole-heartedly agree with the sentiment, though. We need to get rid of the glo

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Glyph
On Nov 1, 2011, at 12:14 PM, Phil Mayers wrote: > On 01/11/11 15:28, Christopher Armstrong wrote: > >> I whole-heartedly agree with the sentiment, though. We need to get rid >> of the global reactor. > > Why? Sometimes you want a different reactor. The most common reason is unit testing, alth

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Phil Mayers
On 01/11/11 17:23, Corbin Simpson wrote: > Singletons are an anti-pattern. Because the reactor is a singleton: Note "some kind of". I don't care how it's done, but I would have liked the common use case (single reactor) to require no extra typing. But I think that ship has sailed. ___

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Corbin Simpson
On Tue, Nov 1, 2011 at 10:06 AM, Phil Mayers wrote: > On 01/11/11 16:58, Itamar Turner-Trauring wrote: >>> I find the "pass reactor as 1st argument to everything" API pattern >>> messy. I'm sure there's a good reason. What is it? >> >> 1. Supporting multiple reactors. > > Interesting. I had assume

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Phil Mayers
On 01/11/11 16:58, Itamar Turner-Trauring wrote: >> I find the "pass reactor as 1st argument to everything" API pattern >> messy. I'm sure there's a good reason. What is it? > > 1. Supporting multiple reactors. Interesting. I had assumed that was a "never on the cards" option. Would it be possibl

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Itamar Turner-Trauring
> I find the "pass reactor as 1st argument to everything" API pattern > messy. I'm sure there's a good reason. What is it? 1. Supporting multiple reactors. 2. Unit testing: if you have an explicit object, you can replace it more easily with a fake. __

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Phil Mayers
On 01/11/11 16:18, Jonathan Lange wrote: > On Tue, Nov 1, 2011 at 12:14 PM, Phil Mayers wrote: >> On 01/11/11 15:28, Christopher Armstrong wrote: >> >>> I whole-heartedly agree with the sentiment, though. We need to get rid >>> of the global reactor. >> >> Why? >> >> I find the "pass reactor as 1s

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Jonathan Lange
On Tue, Nov 1, 2011 at 12:14 PM, Phil Mayers wrote: > On 01/11/11 15:28, Christopher Armstrong wrote: > >> I whole-heartedly agree with the sentiment, though. We need to get rid >> of the global reactor. > > Why? > > I find the "pass reactor as 1st argument to everything" API pattern > messy. I'm

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Phil Mayers
On 01/11/11 15:28, Christopher Armstrong wrote: > I whole-heartedly agree with the sentiment, though. We need to get rid > of the global reactor. Why? I find the "pass reactor as 1st argument to everything" API pattern messy. I'm sure there's a good reason. What is it?

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Christopher Armstrong
On Tue, Nov 1, 2011 at 10:49 AM, Laurens Van Houtven <_...@lvh.cc> wrote: > +1. > > Agree completely, did not realize this was still a point of contention. > > I think the only point of contention would be if you're trying to modify an existing piece of code that uses the global reactor, and you

Re: [Twisted-Python] Global reactor unit tests in the Twisted test suite

2011-11-01 Thread Laurens Van Houtven
+1. Agree completely, did not realize this was still a point of contention. ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python