OlegG has asked for the wisdom of the Perl Monks concerning the following question:

Let's assume I have some module on CPAN and tests to this module. Some test are very slow. I want to skip this slow tests if someone installs my module via CPAN. I can add something like:
SKIP: { skip "You should set RUN_SLOW_TESTS to run this" unless $ENV{RUN_SLO +W_TESTS}; # slow test goes here ... }
This makes the job. But at the same time it will be good if this slow tests will run by CPAN Testers anyway. Because here process of running the test are automated and slow tests are not so annoying as for user of my module.
So, is it a way to know that test now runs in cpantesters environment? Maybe some environment variable to check?

Replies are listed 'Best First'.
Re: Detect is my test run by cpantesters
by AppleFritter (Vicar) on Aug 16, 2014 at 16:10 UTC

    From the CPAN Authors FAQ:

    "Can I tell if my module is being tested by an automated client (a.k.a. 'smoker')?"

    Automated smoke testers should set $ENV{AUTOMATED_TESTING} to a true value. This allows authors to skip certain tests (or include certain tests) when the results are not being monitored by a human being.

    One could even go so far as to halt building and testing a distribution under automated testing by exiting with zero at the top of the Makefile.PL or Build.PL file:

    exit 0 if $ENV{AUTOMATED_TESTING};

    Hope this helps!

      Thanks! This is exactly what I am looking for

        It might also be worth checking $ENV{EXTENDED_TESTING} - this is the recommended environment variable that people are supposed to set to opt-in to running additional test cases.

        See also: Lancaster Consensus.