Re: Network connection

[email protected] (James E Keenan) Tue, 14 Nov 2017 20:43:38 -0500
Newsgroups perl.cpan.workers
Message-ID <[email protected]>
On 11/12/2017 12:01 PM, David Golden wrote:
> There's https://metacpan.org/pod/Test::Internet and 
> https://metacpan.org/pod/Test::RequiresInternet .
> 
> I do recommend restricting those AUTOMATED_TESTING or AUTHOR_TESTING.
> 
> There's also the core-only approach like is used in HTTP::Tiny: 
> https://metacpan.org/source/DAGOLDEN/HTTP-Tiny-0.070/t/200_live.t
> 
> David
> 
> 
> On Sun, Nov 12, 2017 at 9:59 AM, James E Keenan <[email protected] 
> <mailto:[email protected]>> wrote:
> 
>     Is there any code which is considered "best practice" for "skip_all
>     unless I have an Internet connection"?
> 
>     For the first time I want to write a library whose tests will
>     benefit from connection to an FTP server.  If there is some code
>     that I could just drop in for situations where the test suite is run
>     offline, that would be helpful.
> 
>     Thank you very much.
>     Jim Keenan
> 

I ended up going with both Test::RequiresInternet and an envvar named 
PERL_ALLOW_NETWORK_TESTING normally set to off.  So time-consuming tests 
will only be attempted if there's a network connection and if the user 
wants to run tests which attempt that connection.

Thank you very much.
Jim Keenan