Subject: | The test suite fails if no network |
Hi,
I've tried to install URI::Fetch in a plane, using my local minicpan.
Actually, it was a dependency for another module, and I had to force
the install to be able to install the other module.
Anyway, the test scripts that need the network should skip_all if
no network is detected.
Attached are patches to the relevant test scripts, as well as a
t/Util.pm module that provides the web_ok() method used to test
for the network.
Also, the module doesn't initialize its useragent with env_proxy,
so a proxy will not be detected (note that the web_ok() method
uses env_proxy, so that might lead to differences).
Regards.
-- BooK
Subject: | test_scripts.patch |
diff -ru URI-Fetch-0.08.orig/MANIFEST URI-Fetch-0.08/MANIFEST
--- URI-Fetch-0.08.orig/MANIFEST 2006-07-25 07:42:17.000000000 +0200
+++ URI-Fetch-0.08/MANIFEST 2007-07-19 19:21:04.000000000 +0200
@@ -22,3 +22,4 @@
t/00-compile.t
t/01-fetch.t
t/02-freezethaw.t
+t/Util.pm
Only in URI-Fetch-0.08: MANIFEST.bak
Only in URI-Fetch-0.08: Makefile.old
diff -ru URI-Fetch-0.08.orig/t/01-fetch.t URI-Fetch-0.08/t/01-fetch.t
--- URI-Fetch-0.08.orig/t/01-fetch.t 2006-06-19 05:03:45.000000000 +0200
+++ URI-Fetch-0.08/t/01-fetch.t 2007-07-18 21:54:13.000000000 +0200
@@ -1,7 +1,7 @@
# $Id: 01-fetch.t 1941 2006-06-19 03:03:44Z btrott $
use strict;
-use Test::More tests => 76;
+use Test::More;
use URI::Fetch;
use constant BASE => 'http://stupidfool.org/perl/feeds/';
@@ -10,6 +10,10 @@
use constant URI_GONE => BASE . 'gone.xml';
use constant URI_ERROR => BASE . 'error.xml';
+use t::Util;
+plan skip_all => 'No web connection detected' unless web_ok();
+plan test => 76;
+
my($res, $xml, $etag, $mtime);
## Test a basic fetch.
diff -ru URI-Fetch-0.08.orig/t/02-freezethaw.t URI-Fetch-0.08/t/02-freezethaw.t
--- URI-Fetch-0.08.orig/t/02-freezethaw.t 2005-10-10 07:35:23.000000000 +0200
+++ URI-Fetch-0.08/t/02-freezethaw.t 2007-07-18 21:59:09.000000000 +0200
@@ -1,12 +1,16 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 11;
+use Test::More;
use URI::Fetch;
use Data::Dumper;
use constant URI_OK => 'http://stupidfool.org/perl/feeds/ok.xml';
+use t::Util;
+plan skip_all => 'No web connection detected' unless web_ok();
+plan tests => 11;
+
my($res, $xml, $etag, $mtime);
## Test a regular fetch using a cache and alternate freeze/thaw.
Only in URI-Fetch-0.08/t: Util.pm
Subject: | Util.pm |
# check that the web connection is working
sub web_ok {
my $ua = LWP::UserAgent->new( env_proxy => 1, timeout => 30 );
my $res =
$ua->request(
HTTP::Request->new( GET => shift||'http://www.google.com/intl/en/' ) );
return $res->is_success;
}
1;