Fix last remaining tests with -T under < 5.10
[dbsrgits/DBIx-Class.git] / xt / extra / lean_startup.t
index 072f585..d107bb8 100644 (file)
@@ -3,12 +3,6 @@
 
 my ($initial_inc_contents, $expected_dbic_deps, $require_sites);
 BEGIN {
-  # these envvars *will* bring in more stuff than the baseline
-  delete @ENV{qw(DBICTEST_SQLT_DEPLOY DBIC_TRACE)};
-
-  # make sure extras do not load even when this is set
-  $ENV{PERL_STRICTURES_EXTRA} = 1;
-
   unshift @INC, 't/lib';
   require DBICTest::Util::OverrideRequire;
 
@@ -53,10 +47,8 @@ BEGIN {
       CORE::require('Test/More.pm');
       Test::More::fail ("Unexpected require of '$req' by $caller[0] ($caller[1] line $caller[2])");
 
-      if ( $ENV{TEST_VERBOSE} or ! DBICTest::RunMode->is_plain ) {
-        CORE::require('DBICTest/Util.pm');
-        Test::More::diag( 'Require invoked' .  DBICTest::Util::stacktrace() );
-      }
+      CORE::require('DBICTest/Util.pm');
+      Test::More::diag( 'Require invoked' .  DBICTest::Util::stacktrace() );
     }
 
     return $res;
@@ -71,8 +63,24 @@ BEGIN {
   plan skip_all => 'A defined PERL5OPT may inject extra deps crashing this test'
     if $ENV{PERL5OPT};
 
+  plan skip_all => 'Presence of sitecustomize.pl may inject extra deps crashing this test'
+    if grep { $_ =~ m| \/ sitecustomize\.pl $ |x } keys %INC;
+
   plan skip_all => 'Dependency load patterns are radically different before perl 5.10'
-    if $] < 5.010;
+    if "$]" < 5.010;
+
+  # these envvars *will* bring in more stuff than the baseline
+  delete @ENV{qw(
+    DBIC_TRACE
+    DBICTEST_SQLT_DEPLOY
+    DBICTEST_VIA_REPLICATED
+    DBICTEST_DEBUG_CONCURRENCY_LOCKS
+  )};
+
+  $ENV{DBICTEST_ANFANG_DEFANG} = 1;
+
+  # make sure extras do not load even when this is set
+  $ENV{PERL_STRICTURES_EXTRA} = 1;
 
   # add what we loaded so far
   for (keys %INC) {
@@ -83,6 +91,7 @@ BEGIN {
   }
 }
 
+
 #######
 ### This is where the test starts
 #######
@@ -192,16 +201,11 @@ sub assert_no_missing_expected_requires {
   my $nl;
   for my $mod (keys %$expected_dbic_deps) {
     (my $modfn = "$mod.pm") =~ s/::/\//g;
-    unless ($INC{$modfn}) {
-      my $err = sprintf "Expected DBIC core dependency '%s' never loaded - %s needs adjustment", $mod, __FILE__;
-      if (DBICTest::RunMode->is_smoker or DBICTest::RunMode->is_author) {
-        fail ($err)
-      }
-      else {
-        diag "\n" unless $nl->{$mod}++;
-        diag $err;
-      }
-    }
+    fail sprintf (
+      "Expected DBIC core dependency '%s' never loaded - %s needs adjustment",
+      $mod,
+      __FILE__
+    ) unless $INC{$modfn};
   }
   pass(sprintf 'All modules expected at %s line %s loaded by DBIC: %s',
     __FILE__,