Changeset 1344

Show
Ignore:
Timestamp:
08/16/06 22:39:06
Author:
youpy
Message:

TestPlagger?: test_requires_network() allows host to check network availability

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/t/TestPlagger.pm

    r1333 r1344  
    3737} 
    3838 
    39 sub has_network { 
     39sub has_network() { 
     40    my $host = shift; 
    4041    return if $ENV{NO_NETWORK}; 
    4142 
    4243    require IO::Socket::INET; 
    43     my $conn = IO::Socket::INET->new("www.google.com:80"); 
     44    my $conn = IO::Socket::INET->new(PeerAddr => $host, Timeout => 10); 
    4445    defined $conn; 
    4546} 
    4647 
    47 sub test_requires_network { 
    48     unless (has_network) { 
    49         plan skip_all => "Test requires network which is not available now."; 
     48sub test_requires_network() { 
     49    my $host = shift || 'www.google.com:80'; 
     50 
     51    unless (has_network($host)) { 
     52        plan skip_all => "Test requires network($host) which is not available now."; 
    5053    } 
    5154} 
  • trunk/plagger/t/plugins/Filter-EntryFullText/pitchforkmedia.t

    r1342 r1344  
    33test_plugin_deps; 
    44test_requires 'HTML::TreeBuilder::XPath', 0; 
    5 test_requires_network
     5test_requires_network 'www.pitchforkmedia.com:80'
    66 
    77plan 'no_plan';