1Test2::Require::Module(U3s)er Contributed Perl DocumentatTieosnt2::Require::Module(3)
2
3
4
6 Test2::Require::Module - Skip tests if certain packages are not
7 installed, or insufficient versions.
8
10 Sometimes you have tests that are nice to run, but depend on tools that
11 may not be available. Instead of adding the tool as a dep, or making
12 the test always skip, it is common to make the test run conditionally.
13 This package helps make that possible.
14
15 This module is modeled after Test::Requires. The difference is that
16 this module is based on Test2 directly, and does not go through
17 Test::Builder. Another difference is that the packages you check for
18 are not imported into your namespace for you. This is intentional.
19
21 # The test will be skipped unless Some::Module is installed, any version.
22 use Test2::Require::Module 'Some::Module';
23
24 # The test will be skipped unless 'Other::Module' is installed and at
25 # version '5.555' or greater.
26 use Test2::Require::Module 'Other::Module' => '5.555';
27
28 # We now need to use them directly, Test2::Require::Module does not import
29 # them for us.
30 use Some::Module;
31 use Other::Module;
32
34 The source code repository for Test2-Suite can be found at
35 https://github.com/Test-More/Test2-Suite/.
36
38 Chad Granum <exodist@cpan.org>
39
41 Chad Granum <exodist@cpan.org>
42
44 Copyright 2018 Chad Granum <exodist@cpan.org>.
45
46 This program is free software; you can redistribute it and/or modify it
47 under the same terms as Perl itself.
48
49 See http://dev.perl.org/licenses/
50
51
52
53perl v5.38.0 2023-07-21 Test2::Require::Module(3)