Skip to content

kentfredric/Test-WithNetwork

Repository files navigation

NAME

Test::WithNetwork - Indicate a test requires Network resources to work.

VERSION

version 0.001000

SYNOPSIS

In Tests

Per-File Filter

use Test::More;
use Test::WithNetwork 'Dist-Foo-Bar' => [qw( dns tcp ssl )]; # exit skip if policy doesn't indicate all are permitted.

Localised Filter

use Test::More;
use Test::WithNetwork 'Dist-Foo-Bar';

with_network [qw( dns tcp )] => sub {
  # Tests that require network resources

};
# Non-network depedndent tests

Conditional Checking

use Test::More;
use Test::WithNetwork 'Dist-Foo-Bar';

if ( can_network(qw( dns tcp )) ) {
  # Tests that require network resources

};
# Non-network depedndent tests

User Side

~/.perl_test_withnetwork.ini

-permission_denied = silent
; -permission_denied = warn
; -permission_denied = log
; -log_file = /tmp/test-with-network.log
dns = y
tcp = n
ssl = n

# Special grants for Dist-Foo-Bar
[Dist-Foo-Bar]
# dns inherited from global
tcp = y

Standard Test output

t/01-somenetworkthing: Test::WithNetwork was not granted Dist-Foo-Bar/ssl permission. Skipped.
t/02-somenetworkthing: Test::WithNetwork was not granted Dist-Foo-Bar/ssl permission. Skipped some tests.

AUTHOR

Kent Fredric kentfredric@gmail.com

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Kent Fredric kentfredric@gmail.com.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

About

Indicate a test requires Network resources to work

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages