Re: [Twisted-Python] Trial & the mock library

2013-07-27 Thread Jonathan Lange
On Sat, Jul 27, 2013 at 5:26 AM, Glyph wrote: > > On Jul 26, 2013, at 7:12 AM, exar...@twistedmatrix.com wrote: > > To address this problem, I suggest you get into the habit of watching your > unit tests fail in the expected way before you make the necessary > implementation changes to make them

Re: [Twisted-Python] Trial & the mock library

2013-07-26 Thread Glyph
On Jul 26, 2013, at 7:12 AM, exar...@twistedmatrix.com wrote: > To address this problem, I suggest you get into the habit of watching your > unit tests fail in the expected way before you make the necessary > implementation changes to make them pass. > > This is only one of an unlimited number

Re: [Twisted-Python] Trial & the mock library

2013-07-26 Thread exarkun
On 25 Jul, 02:25 pm, jamesbroadh...@gmail.com wrote: Hey all - I've recently started working with the 'mock' library in our trial tests, and am looking for some best-practice advice. I'm really just starting to get used to the library, so it might well have functionality that I'm unaware of

Re: [Twisted-Python] Trial & the mock library

2013-07-26 Thread Terry Jones
> That sounds like a great idea, I wonder if anyone's thought of it before. I suggested this in #twisted a few years back and was immediately told it was a bad idea (names withheld!). Another case in which this pops up is if you accidentally yield some deferreds in a test but don't decorate with

Re: [Twisted-Python] Trial & the mock library

2013-07-26 Thread Glyph
On Jul 25, 2013, at 6:51 PM, Matt Haggard wrote: > I have a few thoughts: > > First, how does this hypothetical system for specifying return types solve > the original problem (that user-written methods on TestCase pass unexpectedly > when a non-Deferred is returned)? If I'm the one writing

Re: [Twisted-Python] Trial & the mock library

2013-07-26 Thread Jonathan Lange
On Fri, Jul 26, 2013 at 12:12 AM, Glyph wrote: > > On Jul 25, 2013, at 3:51 PM, exar...@twistedmatrix.com wrote: > > On 08:33 pm, gl...@twistedmatrix.com wrote: > > > On Jul 25, 2013, at 8:40 AM, Jonathan Lange wrote: > > On Thu, Jul 25, 2013 at 4:14 PM, Laurens Van Houtven <_...@lvh.io> wrote:

Re: [Twisted-Python] Trial & the mock library

2013-07-25 Thread Matt Haggard
I have a few thoughts: First, how does this hypothetical system for specifying return types solve the original problem (that user-written methods on TestCase pass unexpectedly when a non-Deferred is returned)? If I'm the one writing test_whatever, with the proposed doc string method for specifyin

Re: [Twisted-Python] Trial & the mock library

2013-07-25 Thread Glyph
On Jul 25, 2013, at 3:51 PM, exar...@twistedmatrix.com wrote: > On 08:33 pm, gl...@twistedmatrix.com wrote: >> >> On Jul 25, 2013, at 8:40 AM, Jonathan Lange wrote: >>> On Thu, Jul 25, 2013 at 4:14 PM, Laurens Van Houtven <_...@lvh.io> wrote: >>> In addition to what jml said, I wonder if it mak

Re: [Twisted-Python] Trial & the mock library

2013-07-25 Thread exarkun
On 08:33 pm, gl...@twistedmatrix.com wrote: On Jul 25, 2013, at 8:40 AM, Jonathan Lange wrote: On Thu, Jul 25, 2013 at 4:14 PM, Laurens Van Houtven <_...@lvh.io> wrote: In addition to what jml said, I wonder if it makes sense for TestCase to raise when the return value of a test method is som

Re: [Twisted-Python] Trial & the mock library

2013-07-25 Thread Glyph
On Jul 25, 2013, at 8:40 AM, Jonathan Lange wrote: > On Thu, Jul 25, 2013 at 4:14 PM, Laurens Van Houtven <_...@lvh.io> wrote: > In addition to what jml said, I wonder if it makes sense for TestCase to > raise when the return value of a test method is something other than None or > a Deferred.

Re: [Twisted-Python] Trial & the mock library

2013-07-25 Thread Jonathan Lange
On Thu, Jul 25, 2013 at 4:14 PM, Laurens Van Houtven <_...@lvh.io> wrote: > In addition to what jml said, I wonder if it makes sense for TestCase to > raise when the return value of a test method is something other than None > or a Deferred... > > Why stop there? Why not have a generic system to a

Re: [Twisted-Python] Trial & the mock library

2013-07-25 Thread Laurens Van Houtven
In addition to what jml said, I wonder if it makes sense for TestCase to raise when the return value of a test method is something other than None or a Deferred... cheers lvh ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twisted

Re: [Twisted-Python] Trial & the mock library

2013-07-25 Thread Jonathan Lange
On Thu, Jul 25, 2013 at 3:25 PM, James Broadhead wrote: > I very quickly ran into a problem where I mistakenly returned a Mock() in > the place of a deferred, causing the asserts in callbacks to not be called, > and for the test to spuriously pass. > > A slightly more believable example: > == mycl