From: Graham Knop Date: Sun, 10 Mar 2019 17:14:20 +0000 (+0100) Subject: use isolated subdirectory when testing for extras detection X-Git-Tag: v2.000006~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2Fstrictures.git;a=commitdiff_plain;h=434ad4460d11745bf484432bacfcbec6f140ba61 use isolated subdirectory when testing for extras detection Since the module checks parent directories for some files/directories to detect if it should run in dev mode, run the tests from an isolated subdirectory. This ensures nothing in the temp directory or something above it can interfere. --- diff --git a/t/extras.t b/t/extras.t index a71d46a..8301bf4 100644 --- a/t/extras.t +++ b/t/extras.t @@ -6,6 +6,8 @@ use Test::More 0.88; plan skip_all => 'Extra tests disabled on perls <= 5.008003' unless "$]" >= 5.008_004; use File::Temp; +use File::Spec; +use File::Path qw(mkpath rmtree); use Cwd 'cwd'; my %extras; @@ -30,7 +32,9 @@ my $cwd = cwd; for my $version ( 1, 2 ) { my $tempdir = File::Temp::tempdir('strictures-XXXXXX', CLEANUP => 1, TMPDIR => 1); - chdir $tempdir; + my $subtemp = File::Spec->catdir($tempdir, 'sub1', 'sub2'); + mkpath $subtemp; + chdir $subtemp; local $strictures::Smells_Like_VCS = undef; eval qq{ @@ -55,7 +59,7 @@ use strictures $version; } chdir $cwd; - rmdir $tempdir; + rmtree $tempdir; local $strictures::Smells_Like_VCS = 1;