Re: Best practice for unit tests that rely on internet access?

2011-05-05 Thread Mark Morgan
On 29 April 2011 02:15, Toby Wintermute wrote: > What is the best practice for writing unit tests that rely on internet > access? > > ie. You have a CPAN module which is all about talking to a web > service.. So you have unit tests that do just that. > What if the system testing it doesn't allow

Re: Best practice for unit tests that rely on internet access?

2011-05-04 Thread David Cantrell
On Wed, May 04, 2011 at 01:07:52PM +0100, Paul Makepeace wrote: > On Wed, May 4, 2011 at 12:24, David Cantrell wrote: > > I would consider the impact of trying to grab penthouse's robots.txt, > > especially when it would only be accessed when testing a perl module, to > > be so minimal as to be of

Re: Best practice for unit tests that rely on internet access?

2011-05-04 Thread David Cantrell
On Wed, May 04, 2011 at 12:51:01PM +0100, Peter Edwards wrote: > Often you can put the connectivity tests in the developer tests in the xt/ > directory and then they don't need to be run at install time. But then they only get run whenever the developer is paying attention to the module, which is

Re: Best practice for unit tests that rely on internet access?

2011-05-04 Thread Paul Makepeace
On Wed, May 4, 2011 at 12:24, David Cantrell wrote: > On Tue, May 03, 2011 at 10:39:17PM +0100, Alexander Clouter wrote: >> David Cantrell wrote: >> > You could always check whether outbound HTTP is allowed by connecting to >> > somewhere entirely different.  Try penthouse or thepiratebay - >> >

Re: Best practice for unit tests that rely on internet access?

2011-05-04 Thread Peter Edwards
On 4 May 2011 12:24, David Cantrell wrote: > On Tue, May 03, 2011 at 10:39:17PM +0100, Alexander Clouter wrote: > > David Cantrell wrote: > > > You could always check whether outbound HTTP is allowed by connecting > to > > > somewhere entirely different. Try penthouse or thepiratebay - > Argh.

Re: Best practice for unit tests that rely on internet access?

2011-05-04 Thread David Cantrell
On Tue, May 03, 2011 at 10:39:17PM +0100, Alexander Clouter wrote: > David Cantrell wrote: > > You could always check whether outbound HTTP is allowed by connecting to > > somewhere entirely different. Try penthouse or thepiratebay - > > somewhere which is highly unlikely to have been explicitly

Re: Best practice for unit tests that rely on internet access?

2011-05-03 Thread Toby Wintermute
Hmm, so using LWP::Online, and putting a sensible minimum version of Perl in my Makefile (5.8.8) have removed most of the failures.. but I'm still getting occasional automated test failure reports that confuse me.. The tests have passed some API calls, so must be online, but then fail on a specific

Re: Best practice for unit tests that rely on internet access?

2011-05-03 Thread Alexander Clouter
David Cantrell wrote: > >> b) Only run the tests if specifically set by AUTHOR_TEST or something, >> otherwise mock the server? (I dislike this.. means few good tests run >> for users) >> c) Try to test if there's a working connection, and silently skip the >> tests if not? (Risks skipping tests

Re: Best practice for unit tests that rely on internet access?

2011-05-03 Thread David Cantrell
On Tue, May 03, 2011 at 04:31:02PM +0100, Mark Fowler wrote: > On Tue, May 3, 2011 at 2:09 PM, David Cantrell wrote: > > Interactivity is fine, provided it has sensible defaults. > It's worth knowing about the ExtUtils::MakeMaker::prompt function > which can be used to ask simple interactive quest

Re: Best practice for unit tests that rely on internet access?

2011-05-03 Thread Mark Fowler
On Tue, May 3, 2011 at 2:09 PM, David Cantrell wrote: > Interactivity is fine, provided it has sensible defaults. It's worth knowing about the ExtUtils::MakeMaker::prompt function which can be used to ask simple interactive questions. In particular this will allow you to specify a default (e.g.

Re: Best practice for unit tests that rely on internet access?

2011-05-03 Thread David Cantrell
On Fri, Apr 29, 2011 at 11:15:58AM +1000, Toby Wintermute wrote: > What is the best practice for writing unit tests that rely on internet access? > > ie. You have a CPAN module which is all about talking to a web > service.. So you have unit tests that do just that. > What if the system testing it

Re: Best practice for unit tests that rely on internet access?

2011-05-01 Thread Toby Wintermute
On 1 May 2011 19:14, Dave Hodgkinson wrote: > Isn't is traditional in an interactive CPAN shell session to ask if people > want to connect to the internet and run the real tests? It seems to be traditional, but I don't like it and hope it isn't best practice. I hate it when I ask CPANPLUS to ins

Re: Best practice for unit tests that rely on internet access?

2011-05-01 Thread Toby Wintermute
On 1 May 2011 08:34, David Precious wrote: > On Friday 29 April 2011 08:33:47 Leon Brocard wrote: >> If the module is all about testing a live service then by all means test >> it. Unless it takes too long, or costs money, or might change in the >> future when you don't have time to update the mod

Re: Best practice for unit tests that rely on internet access?

2011-05-01 Thread Dave Hodgkinson
Isn't is traditional in an interactive CPAN shell session to ask if people want to connect to the internet and run the real tests? And as long as it installs quickly and cleanly under cpanm then the rest of the world is happy too... On 29 Apr 2011, at 02:15, Toby Wintermute wrote: > What is the

Re: Best practice for unit tests that rely on internet access?

2011-04-30 Thread David Precious
On Friday 29 April 2011 08:33:47 Leon Brocard wrote: > If the module is all about testing a live service then by all means test > it. Unless it takes too long, or costs money, or might change in the > future when you don't have time to update the module... Arguably, if whatever service the module

Re: Best practice for unit tests that rely on internet access?

2011-04-29 Thread Paul Johnson
On Fri, Apr 29, 2011 at 11:15:58AM +1000, Toby Wintermute wrote: > What is the best practice for writing unit tests that rely on internet access? > > ie. You have a CPAN module which is all about talking to a web > service.. So you have unit tests that do just that. > What if the system testing it

Re: Best practice for unit tests that rely on internet access?

2011-04-29 Thread Leon Brocard
On 29/04/11 02:15, Toby Wintermute wrote: > c) Try to test if there's a working connection, and silently skip the > tests if not? (Risks skipping tests if the connect fails for other > reasons than no outbound HTTP allowed) This module might be useful for the test: http://search.cpan.org/dist/

Re: Best practice for unit tests that rely on internet access?

2011-04-28 Thread Avleen Vig
On Thu, Apr 28, 2011 at 8:15 PM, Toby Wintermute wrote: > What is the best practice for writing unit tests that rely on internet > access? > > ie. You have a CPAN module which is all about talking to a web > service.. So you have unit tests that do just that. > What if the system testing it doesn

Best practice for unit tests that rely on internet access?

2011-04-28 Thread Toby Wintermute
What is the best practice for writing unit tests that rely on internet access? ie. You have a CPAN module which is all about talking to a web service.. So you have unit tests that do just that. What if the system testing it doesn't allow HTTP connections out? The tests will fail.. Should one a) P