Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Skip tests if/unless $ENV{FOO} is set using Test::More

by halley (Prior)
on Apr 29, 2003 at 17:15 UTC ( [id://254022]=note: print w/replies, xml ) Need Help??

in reply to Skip tests if/unless $ENV{FOO} is set using Test::More

This sounds great, but the "accounting" in your example looks like a hassle. Maybe there's a good way to do the following (pseudocode):
    use Test::More tests => 25; # 25 unconditionally ... ADDITIONAL: { skip "Skipping additional tests; try ENV{ALL_TESTS}\n", ADDITIONAL unless $ENV{ALL_TESTS}; $Test::More::tests += 95; # 95 more tests here ... }

[ e d @ h a l l e y . c c ]

Replies are listed 'Best First'.
Re^2: Skip tests if/unless $ENV{FOO} is set using Test::More
by adrianh (Chancellor) on Apr 29, 2003 at 20:00 UTC
    1. To my eyes this looks more complex than merlyn's example.
    2. You can't do it this way since you need to know the total number of tests before the tests are run so Test::Builder can output an appropriate test header.

      If you're using Test::Harness of 2.0 or newer, you don't need to set a test header. It's still a good idea in cases where you can accidentally run too many tests (see the tests for File::Find, if you're lacking essential horror in your life), but it's not required.

      schwern's even suggested relaxing the requirement for headers in general.

        Your right.

        Should have been clearer. You can't do it that way if you want to provide Test::Harness with a test header.

        Personally I like to do this since it protects me from accidentally dropping tests (many a slip between cut and paste ;-)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://254022]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-12 12:18 GMT
Find Nodes?
    Voting Booth?

    No recent polls found