Only load DBICTest::Schema when needed in tests
[dbsrgits/DBIx-Class.git] / t / lib / DBICTest / BaseSchema.pm
index cdc7a02..c68d7fd 100644 (file)
@@ -257,7 +257,11 @@ sub clone {
 }
 
 END {
-  assert_empty_weakregistry($weak_registry, 'quiet');
+  # Make sure we run after any cleanup in other END blocks
+  require B;
+  push @{ B::end_av()->object_2svref }, sub {
+    assert_empty_weakregistry($weak_registry, 'quiet');
+  };
 }
 
 1;