From: Peter Rabbitson Date: Wed, 11 Feb 2015 13:13:28 +0000 (+0100) Subject: Revert 2c2bc4e5 - it is entirely superseded by cb551b07, 2baba3d9 and 83eef562 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c7e856308aeac1faa6f4d8ad59da096e009d70f4;p=dbsrgits%2FDBIx-Class.git Revert 2c2bc4e5 - it is entirely superseded by cb551b07, 2baba3d9 and 83eef562 if all the skipping already happens before DBICTest(::Schema) is loaded, I have no objection to reverting that --- diff --git a/Changes b/Changes index 890f685..b06a571 100644 --- a/Changes +++ b/Changes @@ -6,8 +6,6 @@ Revision history for DBIx::Class * Misc - Speed up skipping CDBICompat tests when dependencies are missing - - Avoid loading DBICTest::Schema unnecessarily in tests that - are being skipped 0.082801 2014-10-05 23:55 (UTC) * Known Issues diff --git a/t/102load_classes.t b/t/102load_classes.t index c3039e5..8936014 100644 --- a/t/102load_classes.t +++ b/t/102load_classes.t @@ -4,7 +4,6 @@ use Test::More; use lib 't/lib'; use DBICTest; -use DBICTest::Schema; my $warnings; eval { diff --git a/t/103many_to_many_warning.t b/t/103many_to_many_warning.t index 2dcc271..2c42091 100644 --- a/t/103many_to_many_warning.t +++ b/t/103many_to_many_warning.t @@ -4,7 +4,6 @@ use Test::More; use lib qw(t/lib); use DBICTest; -use DBICTest::Schema; my $exp_warn = qr/The many-to-many relationship 'bars' is trying to create/; diff --git a/t/50fork.t b/t/50fork.t index 71c4808..af61dca 100644 --- a/t/50fork.t +++ b/t/50fork.t @@ -24,7 +24,7 @@ if($num_children !~ /^[0-9]+$/ || $num_children < 10) { $num_children = 10; } -my $schema = DBICTest->connect_schema($dsn, $user, $pass, { AutoCommit => 1 }); +my $schema = DBICTest::Schema->connect($dsn, $user, $pass, { AutoCommit => 1 }); my $parent_rs; diff --git a/t/60core.t b/t/60core.t index 1f7e5f9..70c2ea1 100644 --- a/t/60core.t +++ b/t/60core.t @@ -581,7 +581,7 @@ lives_ok (sub { my $newlink = $newbook->link}, "stringify to false value doesn't # make sure we got rid of the compat shims SKIP: { my $remove_version = 0.083; - skip "Remove in $remove_version", 3 if DBIx::Class->VERSION < $remove_version; + skip "Remove in $remove_version", 3 if $DBIx::Class::VERSION < $remove_version; for (qw/compare_relationship_keys pk_depends_on resolve_condition/) { ok (! DBIx::Class::ResultSource->can ($_), "$_ no longer provided by DBIx::Class::ResultSource, removed before $remove_version"); @@ -624,7 +624,7 @@ SKIP: { #------------------------------ # SKIP: { - skip "Something needs to be done before 0.09", 2 if DBIx::Class->VERSION < 0.09; + skip "Something needs to be done before 0.09", 2 if $DBIx::Class::VERSION < 0.09; my $row = $schema->resultset ('Artist')->next; diff --git a/t/63register_column.t b/t/63register_column.t index 5579072..21de95d 100644 --- a/t/63register_column.t +++ b/t/63register_column.t @@ -5,7 +5,6 @@ use Test::More; use Test::Exception; use lib qw(t/lib); use DBICTest; -use DBICTest::Schema; lives_ok { DBICTest::Schema->load_classes('PunctuatedColumnName') diff --git a/t/63register_source.t b/t/63register_source.t index 017ca64..6951962 100644 --- a/t/63register_source.t +++ b/t/63register_source.t @@ -4,6 +4,7 @@ use warnings; use Test::Exception tests => 1; use lib qw(t/lib); use DBICTest; +use DBICTest::Schema; use DBIx::Class::ResultSource::Table; my $schema = DBICTest->init_schema(); diff --git a/t/71mysql.t b/t/71mysql.t index 2e54352..ef2c7de 100644 --- a/t/71mysql.t +++ b/t/71mysql.t @@ -20,7 +20,7 @@ my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/}; plan skip_all => 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test' unless ($dsn && $user); -my $schema = DBICTest->connect_schema($dsn, $user, $pass, { quote_names => 1 }); +my $schema = DBICTest::Schema->connect($dsn, $user, $pass, { quote_names => 1 }); my $dbh = $schema->storage->dbh; @@ -52,7 +52,7 @@ $dbh->do("CREATE TABLE books (id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, so # make sure sqlt_type overrides work (::Storage::DBI::mysql does this) { - my $schema = DBICTest->connect_schema($dsn, $user, $pass); + my $schema = DBICTest::Schema->connect($dsn, $user, $pass); ok (!$schema->storage->_dbh, 'definitely not connected'); is ($schema->storage->sqlt_type, 'MySQL', 'sqlt_type correct pre-connection'); @@ -209,7 +209,7 @@ lives_ok { $cd->set_producers ([ $producer ]) } 'set_relationship doesnt die'; # with it (ribasushi, 2009/07/03) NULLINSEARCH: { - my $ansi_schema = DBICTest->connect_schema ($dsn, $user, $pass, { on_connect_call => 'set_strict_mode' }); + my $ansi_schema = DBICTest::Schema->connect ($dsn, $user, $pass, { on_connect_call => 'set_strict_mode' }); $ansi_schema->resultset('Artist')->create ({ name => 'last created artist' }); @@ -233,7 +233,7 @@ NULLINSEARCH: { # check for proper grouped counts { - my $ansi_schema = DBICTest->connect_schema ($dsn, $user, $pass, { + my $ansi_schema = DBICTest::Schema->connect ($dsn, $user, $pass, { on_connect_call => 'set_strict_mode', quote_char => '`', }); @@ -363,7 +363,7 @@ ZEROINSEARCH: { # make sure find hooks determine driver { - my $schema = DBICTest->connect_schema($dsn, $user, $pass); + my $schema = DBICTest::Schema->connect($dsn, $user, $pass); $schema->resultset("Artist")->find(4); isa_ok($schema->storage->sql_maker, 'DBIx::Class::SQLMaker::MySQL'); } @@ -371,13 +371,13 @@ ZEROINSEARCH: { # make sure the mysql_auto_reconnect buggery is avoided { local $ENV{MOD_PERL} = 'boogiewoogie'; - my $schema = DBICTest->connect_schema($dsn, $user, $pass); + my $schema = DBICTest::Schema->connect($dsn, $user, $pass); ok (! $schema->storage->_get_dbh->{mysql_auto_reconnect}, 'mysql_auto_reconnect unset regardless of ENV' ); # Make sure hardcore forking action still works even if mysql_auto_reconnect # is true (test inspired by ether) - my $schema_autorecon = DBICTest->connect_schema($dsn, $user, $pass, { mysql_auto_reconnect => 1 }); + my $schema_autorecon = DBICTest::Schema->connect($dsn, $user, $pass, { mysql_auto_reconnect => 1 }); my $orig_dbh = $schema_autorecon->storage->_get_dbh; weaken $orig_dbh; diff --git a/t/72pg.t b/t/72pg.t index 67906a5..e93b67d 100644 --- a/t/72pg.t +++ b/t/72pg.t @@ -29,12 +29,11 @@ EOM ### load any test classes that are defined further down in the file via BEGIN blocks our @test_classes; #< array that will be pushed into by test classes defined in this file -require DBICTest::Schema; DBICTest::Schema->load_classes( map {s/.+:://;$_} @test_classes ) if @test_classes; ### pre-connect tests (keep each test separate as to make sure rebless() runs) { - my $s = DBICTest->connect_schema($dsn, $user, $pass); + my $s = DBICTest::Schema->connect($dsn, $user, $pass); ok (!$s->storage->_dbh, 'definitely not connected'); @@ -56,7 +55,7 @@ DBICTest::Schema->load_classes( map {s/.+:://;$_} @test_classes ) if @test_class } { - my $s = DBICTest->connect_schema($dsn, $user, $pass); + my $s = DBICTest::Schema->connect($dsn, $user, $pass); # make sure sqlt_type overrides work (::Storage::DBI::Pg does this) ok (!$s->storage->_dbh, 'definitely not connected'); is ($s->storage->sqlt_type, 'PostgreSQL', 'sqlt_type correct pre-connection'); @@ -65,7 +64,7 @@ DBICTest::Schema->load_classes( map {s/.+:://;$_} @test_classes ) if @test_class # test LIMIT support { - my $schema = DBICTest->connect_schema($dsn, $user, $pass); + my $schema = DBICTest::Schema->connect($dsn, $user, $pass); drop_test_schema($schema); create_test_schema($schema); for (1..6) { @@ -97,14 +96,14 @@ DBICTest::Schema->load_classes( map {s/.+:://;$_} @test_classes ) if @test_class # check if we indeed do support stuff my $test_server_supports_insert_returning = do { - my $si = DBICTest->connect_schema($dsn, $user, $pass)->storage->_server_info; + my $si = DBICTest::Schema->connect($dsn, $user, $pass)->storage->_server_info; die "Unparseable Pg server version: $si->{dbms_version}\n" unless $si->{normalized_dbms_version}; $si->{normalized_dbms_version} < 8.002 ? 0 : 1; }; is ( - DBICTest->connect_schema($dsn, $user, $pass)->storage->_use_insert_returning, + DBICTest::Schema->connect($dsn, $user, $pass)->storage->_use_insert_returning, $test_server_supports_insert_returning, 'insert returning capability guessed correctly' ); @@ -125,7 +124,7 @@ for my $use_insert_returning ($test_server_supports_insert_returning ### test capability override { - my $s = DBICTest->connect_schema($dsn, $user, $pass); + my $s = DBICTest::Schema->connect($dsn, $user, $pass); ok (!$s->storage->_dbh, 'definitely not connected'); @@ -138,7 +137,7 @@ for my $use_insert_returning ($test_server_supports_insert_returning ### connect, create postgres-specific test schema - $schema = DBICTest->connect_schema($dsn, $user, $pass); + $schema = DBICTest::Schema->connect($dsn, $user, $pass); $schema->storage->ensure_connected; drop_test_schema($schema); @@ -368,7 +367,7 @@ lives_ok { $cds->update({ year => '2010' }) } 'Update on prefetched rs'; }, ) { # create a new schema - my $schema2 = DBICTest->connect_schema($dsn, $user, $pass); + my $schema2 = DBICTest::Schema->connect($dsn, $user, $pass); $schema2->source("Artist")->name("dbic_t_schema.artist"); $schema->txn_do( sub { diff --git a/t/72pg_bytea.t b/t/72pg_bytea.t index c18faba..9a6e4de 100644 --- a/t/72pg_bytea.t +++ b/t/72pg_bytea.t @@ -15,7 +15,7 @@ my ($dsn, $dbuser, $dbpass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/} plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test' unless ($dsn && $dbuser); -my $schema = DBICTest->connect_schema($dsn, $dbuser, $dbpass, { AutoCommit => 1 }); +my $schema = DBICTest::Schema->connect($dsn, $dbuser, $dbpass, { AutoCommit => 1 }); if ($schema->storage->_server_info->{normalized_dbms_version} >= 9.0) { if (not try { DBD::Pg->VERSION('2.17.2') }) { diff --git a/t/73oracle.t b/t/73oracle.t index a8a1e70..df38da8 100644 --- a/t/73oracle.t +++ b/t/73oracle.t @@ -62,7 +62,6 @@ $ENV{NLS_LANG} = "AMERICAN"; 1; } -require DBICTest::Schema; DBICTest::Schema->load_classes('ArtistFQN'); # This is in Core now, but it's here just to test that it doesn't break diff --git a/t/73oracle_blob.t b/t/73oracle_blob.t index 20a680e..55b1daf 100644 --- a/t/73oracle_blob.t +++ b/t/73oracle_blob.t @@ -23,7 +23,7 @@ $ENV{NLS_COMP} = "BINARY"; $ENV{NLS_LANG} = "AMERICAN"; my $v = do { - my $si = DBICTest->connect_schema($dsn, $user, $pass)->storage->_server_info; + my $si = DBICTest::Schema->connect($dsn, $user, $pass)->storage->_server_info; $si->{normalized_dbms_version} or die "Unparseable Oracle server version: $si->{dbms_version}\n"; }; @@ -43,7 +43,7 @@ my $dbh; my $schema; for my $opt (@tryopt) { - my $schema = DBICTest->connect_schema($dsn, $user, $pass, $opt); + my $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opt); $dbh = $schema->storage->dbh; my $q = $schema->storage->sql_maker->quote_char || ''; diff --git a/t/73oracle_hq.t b/t/73oracle_hq.t index 26b9bd7..6d27a05 100644 --- a/t/73oracle_hq.t +++ b/t/73oracle_hq.t @@ -24,8 +24,8 @@ plan skip_all => 'Set $ENV{DBICTEST_ORA_DSN}, _USER and _PASS to run this test.' plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('rdbms_oracle') unless DBIx::Class::Optional::Dependencies->req_ok_for ('rdbms_oracle'); -{ - require DBICTest::Schema::Artist; +use DBICTest::Schema::Artist; +BEGIN { DBICTest::Schema::Artist->add_column('parentid'); DBICTest::Schema::Artist->has_many( @@ -40,8 +40,9 @@ plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missin } use DBICTest; +use DBICTest::Schema; -my $schema = DBICTest->connect_schema($dsn, $user, $pass); +my $schema = DBICTest::Schema->connect($dsn, $user, $pass); note "Oracle Version: " . $schema->storage->_server_info->{dbms_version}; diff --git a/t/745db2.t b/t/745db2.t index 88bfd3c..9123330 100644 --- a/t/745db2.t +++ b/t/745db2.t @@ -18,7 +18,7 @@ my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_DB2_${_}" } qw/DSN USER PASS/}; plan skip_all => 'Set $ENV{DBICTEST_DB2_DSN}, _USER and _PASS to run this test' unless ($dsn && $user); -my $schema = DBICTest->connect_schema($dsn, $user, $pass); +my $schema = DBICTest::Schema->connect($dsn, $user, $pass); my $name_sep = $schema->storage->_dbh_get_info('SQL_QUALIFIER_NAME_SEPARATOR'); diff --git a/t/746db2_400.t b/t/746db2_400.t index cb5213b..3a5d902 100644 --- a/t/746db2_400.t +++ b/t/746db2_400.t @@ -21,7 +21,6 @@ plan skip_all => 'Set $ENV{DBICTEST_DB2_400_DSN}, _USER and _PASS to run this te plan tests => 6; -require DBICTest::Schema; my $schema = DBICTest::Schema->connect($dsn, $user, $pass); my $dbh = $schema->storage->dbh; diff --git a/t/746mssql.t b/t/746mssql.t index 598b7a2..e4a9de0 100644 --- a/t/746mssql.t +++ b/t/746mssql.t @@ -18,7 +18,7 @@ plan skip_all => 'Set $ENV{DBICTEST_MSSQL_ODBC_DSN}, _USER and _PASS to run this unless ($dsn && $user); { - my $srv_ver = DBICTest->connect_schema($dsn, $user, $pass)->storage->_server_info->{dbms_version}; + my $srv_ver = DBICTest::Schema->connect($dsn, $user, $pass)->storage->_server_info->{dbms_version}; ok ($srv_ver, 'Got a test server version on fresh schema: ' . ($srv_ver||'???') ); } @@ -64,7 +64,7 @@ my %opts = ( for my $opts_name (keys %opts) { SKIP: { my $opts = $opts{$opts_name}{opts}; - $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts); + $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts); try { $schema->storage->ensure_connected @@ -168,7 +168,7 @@ SQL lives_ok ( sub { # start a new connection, make sure rebless works - my $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts); + my $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts); $schema->populate ('Owners', [ [qw/id name /], [qw/1 wiggle/], @@ -193,7 +193,7 @@ SQL lives_ok (sub { # start a new connection, make sure rebless works # test an insert with a supplied identity, followed by one without - my $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts); + my $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts); for (2, 1) { my $id = $_ * 20 ; $schema->resultset ('Owners')->create ({ id => $id, name => "troglodoogle $id" }); @@ -205,7 +205,7 @@ SQL lives_ok ( sub { # start a new connection, make sure rebless works - my $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts); + my $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts); $schema->populate ('BooksInLibrary', [ [qw/source owner title /], [qw/Library 1 secrets0/], @@ -235,7 +235,7 @@ SQL ) { for my $quoted (0, 1) { - $schema = DBICTest->connect_schema($dsn, $user, $pass, { + $schema = DBICTest::Schema->connect($dsn, $user, $pass, { limit_dialect => $dialect, %$opts, $quoted @@ -420,7 +420,7 @@ SQL }); # start disconnected to make sure insert works on an un-reblessed storage - $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts); + $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts); my $row; lives_ok { diff --git a/t/746sybase.t b/t/746sybase.t index a6729ec..bc6fd16 100644 --- a/t/746sybase.t +++ b/t/746sybase.t @@ -29,7 +29,6 @@ eval "require DBIx::Class::Storage::$_;" for @storage_types; my $schema; my $storage_idx = -1; -require DBICTest::Schema; sub get_schema { DBICTest::Schema->connect($dsn, $user, $pass, { on_connect_call => [ diff --git a/t/747mssql_ado.t b/t/747mssql_ado.t index 9ae7eb1..2ca5806 100644 --- a/t/747mssql_ado.t +++ b/t/747mssql_ado.t @@ -19,7 +19,6 @@ my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_ADO_${_}" } qw/DSN USER PAS plan skip_all => 'Set $ENV{DBICTEST_MSSQL_ADO_DSN}, _USER and _PASS to run this test' unless ($dsn && $user); -require DBICTest::Schema; DBICTest::Schema->load_classes(qw/VaryingMAX ArtistGUID/); my %binstr = ( 'small' => join('', map { chr($_) } ( 1 .. 127 )) ); diff --git a/t/748informix.t b/t/748informix.t index e289d28..42bdac8 100644 --- a/t/748informix.t +++ b/t/748informix.t @@ -17,7 +17,7 @@ my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_INFORMIX_${_}" } qw/DSN USER PASS plan skip_all => 'Set $ENV{DBICTEST_INFORMIX_DSN}, _USER and _PASS to run this test' unless $dsn; -my $schema = DBICTest->connect_schema($dsn, $user, $pass, { +my $schema = DBICTest::Schema->connect($dsn, $user, $pass, { auto_savepoint => 1 }); diff --git a/t/749sqlanywhere.t b/t/749sqlanywhere.t index 0999f6d..a1b9d32 100644 --- a/t/749sqlanywhere.t +++ b/t/749sqlanywhere.t @@ -23,6 +23,8 @@ plan skip_all => 'Test needs ' . or (not $dsn || $dsn2); +DBICTest::Schema->load_classes('ArtistGUID'); + # tests stolen from 748informix.t plan skip_all => <<'EOF' unless $dsn || $dsn2; @@ -30,9 +32,6 @@ Set $ENV{DBICTEST_SQLANYWHERE_DSN} and/or $ENV{DBICTEST_SQLANYWHERE_ODBC_DSN}, _USER and _PASS to run these tests EOF -require DBICTest::Schema; -DBICTest::Schema->load_classes('ArtistGUID'); - my @info = ( [ $dsn, $user, $pass ], [ $dsn2, $user2, $pass2 ], diff --git a/t/74mssql.t b/t/74mssql.t index c0c3e42..263fecb 100644 --- a/t/74mssql.t +++ b/t/74mssql.t @@ -18,13 +18,13 @@ plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missin unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mssql_sybase'); { - my $srv_ver = DBICTest->connect_schema($dsn, $user, $pass)->storage->_server_info->{dbms_version}; + my $srv_ver = DBICTest::Schema->connect($dsn, $user, $pass)->storage->_server_info->{dbms_version}; ok ($srv_ver, 'Got a test server version on fresh schema: ' . ($srv_ver||'???') ); } my $schema; -my $testdb_supports_placeholders = DBICTest->connect_schema($dsn, $user, $pass) +my $testdb_supports_placeholders = DBICTest::Schema->connect($dsn, $user, $pass) ->storage ->_supports_typeless_placeholders; my @test_storages = ( @@ -33,7 +33,7 @@ my @test_storages = ( ); for my $storage_type (@test_storages) { - $schema = DBICTest->connect_schema($dsn, $user, $pass); + $schema = DBICTest::Schema->connect($dsn, $user, $pass); if ($storage_type =~ /NoBindVars\z/) { # since we want to use the nobindvar - disable the capability so the @@ -272,7 +272,8 @@ SQL } { - my $schema = DBICTest->connect_schema($dsn, $user, $pass); + my $schema = DBICTest::Schema->clone; + $schema->connection($dsn, $user, $pass); like $schema->storage->sql_maker->{limit_dialect}, qr/^(?:Top|RowNumberOver)\z/, @@ -283,7 +284,8 @@ SQL # test op-induced autoconnect lives_ok (sub { - my $schema = DBICTest->connect_schema($dsn, $user, $pass); + my $schema = DBICTest::Schema->clone; + $schema->connection($dsn, $user, $pass); my $artist = $schema->resultset ('Artist')->search ({}, { order_by => 'artistid' })->next; is ($artist->id, 1, 'Artist retrieved successfully'); @@ -292,7 +294,7 @@ lives_ok (sub { # test AutoCommit=0 { local $ENV{DBIC_UNSAFE_AUTOCOMMIT_OK} = 1; - my $schema2 = DBICTest->connect_schema($dsn, $user, $pass, { AutoCommit => 0 }); + my $schema2 = DBICTest::Schema->connect($dsn, $user, $pass, { AutoCommit => 0 }); my $rs = $schema2->resultset('Money'); diff --git a/t/750firebird.t b/t/750firebird.t index 9a460ea..cefb040 100644 --- a/t/750firebird.t +++ b/t/750firebird.t @@ -47,7 +47,7 @@ for my $prefix (keys %$env2optdep) { SKIP: { skip ("Testing with ${prefix}_DSN needs " . DBIx::Class::Optional::Dependencies->req_missing_for( $env2optdep->{$prefix} ), 1) unless DBIx::Class::Optional::Dependencies->req_ok_for($env2optdep->{$prefix}); - $schema = DBICTest->connect_schema($dsn, $user, $pass, { + $schema = DBICTest::Schema->connect($dsn, $user, $pass, { auto_savepoint => 1, quote_names => 1, ($dsn !~ /ODBC/ ? (on_connect_call => 'use_softcommit') : ()), diff --git a/t/751msaccess.t b/t/751msaccess.t index 8ea0e2a..b738783 100644 --- a/t/751msaccess.t +++ b/t/751msaccess.t @@ -23,7 +23,6 @@ plan skip_all => 'Test needs ' . or (not $dsn || $dsn2); -require DBICTest::Schema; DBICTest::Schema->load_classes('ArtistGUID'); # Example DSNs (32bit only): diff --git a/t/94versioning.t b/t/94versioning.t index 8dde154..a154d8f 100644 --- a/t/94versioning.t +++ b/t/94versioning.t @@ -33,7 +33,7 @@ BEGIN { # this is just to grab a lock { - my $s = DBICTest->connect_schema($dsn, $user, $pass); + my $s = DBICTest::Schema->connect($dsn, $user, $pass); } # in case it came from the env diff --git a/t/99dbic_sqlt_parser.t b/t/99dbic_sqlt_parser.t index e076e14..0b36850 100644 --- a/t/99dbic_sqlt_parser.t +++ b/t/99dbic_sqlt_parser.t @@ -19,7 +19,6 @@ BEGIN { # Test for SQLT-related leaks { - require DBICTest::Schema; my $s = DBICTest::Schema->clone; my @schemas = ( diff --git a/t/cdbi/sweet/08pager.t b/t/cdbi/sweet/08pager.t index d745883..f645276 100644 --- a/t/cdbi/sweet/08pager.t +++ b/t/cdbi/sweet/08pager.t @@ -5,7 +5,6 @@ use Test::More; use lib 't/cdbi/testlib'; use DBIC::Test::SQLite; -use DBICTest::Schema; DBICTest::Schema::CD->load_components(qw/CDBICompat CDBICompat::Pager/); diff --git a/t/cdbi/testlib/MyBase.pm b/t/cdbi/testlib/MyBase.pm index fa66258..bf55635 100644 --- a/t/cdbi/testlib/MyBase.pm +++ b/t/cdbi/testlib/MyBase.pm @@ -34,7 +34,7 @@ if ($err) { my @connect = (@ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/}, { PrintError => 0}); # this is only so we grab a lock on mysql { - my $x = DBICTest->connect_schema(@connect); + my $x = DBICTest::Schema->connect(@connect); } $dbh = DBI->connect(@connect) or die DBI->errstr; diff --git a/t/inflate/datetime_firebird.t b/t/inflate/datetime_firebird.t index 670fcdf..c958d6b 100644 --- a/t/inflate/datetime_firebird.t +++ b/t/inflate/datetime_firebird.t @@ -37,7 +37,7 @@ for my $prefix (keys %$env2optdep) { SKIP: { skip ("Testing with ${prefix}_DSN needs " . DBIx::Class::Optional::Dependencies->req_missing_for( $env2optdep->{$prefix} ), 1) unless DBIx::Class::Optional::Dependencies->req_ok_for($env2optdep->{$prefix}); - $schema = DBICTest->connect_schema($dsn, $user, $pass, { + $schema = DBICTest::Schema->connect($dsn, $user, $pass, { quote_char => '"', name_sep => '.', on_connect_call => [ 'datetime_setup' ], diff --git a/t/inflate/datetime_informix.t b/t/inflate/datetime_informix.t index a44f81a..8bbd524 100644 --- a/t/inflate/datetime_informix.t +++ b/t/inflate/datetime_informix.t @@ -25,7 +25,7 @@ EOF my $schema; { - $schema = DBICTest->connect_schema($dsn, $user, $pass, { + $schema = DBICTest::Schema->connect($dsn, $user, $pass, { on_connect_call => [ 'datetime_setup' ], }); diff --git a/t/inflate/datetime_msaccess.t b/t/inflate/datetime_msaccess.t index b2f2a8c..f012199 100644 --- a/t/inflate/datetime_msaccess.t +++ b/t/inflate/datetime_msaccess.t @@ -39,7 +39,7 @@ for my $connect_info (@connect_info) { next unless $dsn; - my $schema = DBICTest->connect_schema($dsn, $user, $pass, { + my $schema = DBICTest::Schema->connect($dsn, $user, $pass, { on_connect_call => 'datetime_setup', quote_names => 1, }); diff --git a/t/inflate/datetime_mssql.t b/t/inflate/datetime_mssql.t index 862aa7f..edbac14 100644 --- a/t/inflate/datetime_mssql.t +++ b/t/inflate/datetime_mssql.t @@ -37,7 +37,6 @@ if (not ($dsn || $dsn2 || $dsn3)) { ." 'track'."; } -require DBICTest::Schema; DBICTest::Schema->load_classes('EventSmallDT'); my @connect_info = ( @@ -54,7 +53,7 @@ for my $connect_info (@connect_info) { next unless $dsn; - $schema = DBICTest->connect_schema($dsn, $user, $pass, { + $schema = DBICTest::Schema->connect($dsn, $user, $pass, { on_connect_call => 'datetime_setup' }); diff --git a/t/inflate/datetime_mysql.t b/t/inflate/datetime_mysql.t index e1821db..44699ab 100644 --- a/t/inflate/datetime_mysql.t +++ b/t/inflate/datetime_mysql.t @@ -7,13 +7,13 @@ use Test::Warn; use DBIx::Class::Optional::Dependencies (); use lib qw(t/lib); use DBICTest; +use DBICTest::Schema; use DBIx::Class::_Util 'sigwarn_silencer'; plan skip_all => 'Inflation tests need ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt_mysql') unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt_mysql'); { - require DBICTest::Schema; DBICTest::Schema->load_classes('EventTZ'); local $SIG{__WARN__} = sigwarn_silencer( qr/extra \=\> .+? has been deprecated/ ); DBICTest::Schema->load_classes('EventTZDeprecated'); diff --git a/t/inflate/datetime_oracle.t b/t/inflate/datetime_oracle.t index 1bf0498..9182f23 100644 --- a/t/inflate/datetime_oracle.t +++ b/t/inflate/datetime_oracle.t @@ -24,7 +24,7 @@ $ENV{NLS_LANG} = 'AMERICAN_AMERICA.WE8ISO8859P1'; $ENV{NLS_SORT} = "BINARY"; $ENV{NLS_COMP} = "BINARY"; -my $schema = DBICTest->connect_schema($dsn, $user, $pass); +my $schema = DBICTest::Schema->connect($dsn, $user, $pass); # older oracles do not support a TIMESTAMP datatype my $timestamp_datatype = ($schema->storage->_server_info->{normalized_dbms_version}||0) < 9 diff --git a/t/inflate/datetime_pg.t b/t/inflate/datetime_pg.t index d213500..c02e9f8 100644 --- a/t/inflate/datetime_pg.t +++ b/t/inflate/datetime_pg.t @@ -10,7 +10,6 @@ use DBICTest; plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt_pg') unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt_pg'); -require DBICTest::Schema; DBICTest::Schema->load_classes('EventTZPg'); my $schema = DBICTest->init_schema(); diff --git a/t/inflate/datetime_sqlanywhere.t b/t/inflate/datetime_sqlanywhere.t index c17573b..676665f 100644 --- a/t/inflate/datetime_sqlanywhere.t +++ b/t/inflate/datetime_sqlanywhere.t @@ -43,7 +43,9 @@ foreach my $info (@info) { next unless $dsn; - $schema = DBICTest->connect_schema($dsn, $user, $pass, { + $schema = DBICTest::Schema->clone; + + $schema->connection($dsn, $user, $pass, { on_connect_call => 'datetime_setup', }); diff --git a/t/inflate/datetime_sybase.t b/t/inflate/datetime_sybase.t index ad84e80..597f6a3 100644 --- a/t/inflate/datetime_sybase.t +++ b/t/inflate/datetime_sybase.t @@ -24,7 +24,6 @@ if (not ($dsn && $user)) { "'event_small_dt'"; } -require DBICTest::Schema; DBICTest::Schema->load_classes('EventSmallDT'); my @storage_types = ( diff --git a/t/lib/DBICTest.pm b/t/lib/DBICTest.pm index 49df060..aa20b0c 100644 --- a/t/lib/DBICTest.pm +++ b/t/lib/DBICTest.pm @@ -5,7 +5,7 @@ use strict; use warnings; use DBICTest::Util 'local_umask'; -use DBICTest::RunMode; +use DBICTest::Schema; use DBICTest::Util::LeakTracer qw/populate_weakregistry assert_empty_weakregistry/; use Carp; use Path::Class::File (); @@ -314,8 +314,6 @@ sub init_schema { my $schema; - require DBICTest::Schema; - if ($args{compose_connection}) { $schema = DBICTest::Schema->compose_connection( 'DBICTest', $self->_database(%args) @@ -345,11 +343,7 @@ sub init_schema { } END { - # 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'); - }; } =head2 deploy_schema @@ -576,10 +570,4 @@ sub populate_schema { ]); } -sub connect_schema { - my $self = shift; - require DBICTest::Schema; - return DBICTest::Schema->connect(@_); -} - 1; diff --git a/t/lib/DBICTest/BaseSchema.pm b/t/lib/DBICTest/BaseSchema.pm index c68d7fd..cdc7a02 100644 --- a/t/lib/DBICTest/BaseSchema.pm +++ b/t/lib/DBICTest/BaseSchema.pm @@ -257,11 +257,7 @@ sub clone { } END { - # 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'); - }; + assert_empty_weakregistry($weak_registry, 'quiet'); } 1; diff --git a/t/resultset_class.t b/t/resultset_class.t index 884f590..607c1f2 100644 --- a/t/resultset_class.t +++ b/t/resultset_class.t @@ -7,7 +7,6 @@ unshift(@INC, './t/lib'); use lib 't/lib'; use DBICTest; -use DBICTest::Schema; is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICTest::BaseResultSet', 'default resultset class'); ok(!Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded'); diff --git a/t/sqlmaker/limit_dialects/custom.t b/t/sqlmaker/limit_dialects/custom.t index 15064c2..89c4788 100644 --- a/t/sqlmaker/limit_dialects/custom.t +++ b/t/sqlmaker/limit_dialects/custom.t @@ -22,7 +22,7 @@ use DBICTest ':DiffSQL'; ); } } -my $s = DBICTest->connect_schema (DBICTest->_database); +my $s = DBICTest::Schema->connect (DBICTest->_database); $s->storage->sql_maker_class ('DBICTest::SQLMaker::CustomDialect'); my $rs = $s->resultset ('CD'); diff --git a/t/sqlmaker/mysql.t b/t/sqlmaker/mysql.t index 7307363..0e2ad29 100644 --- a/t/sqlmaker/mysql.t +++ b/t/sqlmaker/mysql.t @@ -6,7 +6,7 @@ use Test::More; use lib qw(t/lib); use DBICTest ':DiffSQL'; -my $schema = DBICTest->connect_schema (DBICTest->_database, { quote_char => '`' }); +my $schema = DBICTest::Schema->connect (DBICTest->_database, { quote_char => '`' }); # cheat require DBIx::Class::Storage::DBI::mysql; *DBIx::Class::Storage::DBI::mysql::_get_server_version = sub { 5 }; diff --git a/t/storage/deploy.t b/t/storage/deploy.t index bb1c7cc..61610ba 100644 --- a/t/storage/deploy.t +++ b/t/storage/deploy.t @@ -21,7 +21,7 @@ local $ENV{DBI_DSN}; # instance, but no conninfo) # there ought to be more code like this in the wild like( - DBICTest->connect_schema->deployment_statements('SQLite'), + DBICTest::Schema->connect->deployment_statements('SQLite'), qr/\bCREATE TABLE artist\b/i # ensure quoting *is* disabled ); diff --git a/t/storage/deprecated_exception_source_bind_attrs.t b/t/storage/deprecated_exception_source_bind_attrs.t index 27dfdfc..f6dca5a 100644 --- a/t/storage/deprecated_exception_source_bind_attrs.t +++ b/t/storage/deprecated_exception_source_bind_attrs.t @@ -6,7 +6,6 @@ use Test::Warn; use Test::Exception; use lib qw(t/lib); use DBICTest; -use DBICTest::Schema; { package DBICTest::Legacy::Storage; diff --git a/t/storage/global_destruction.t b/t/storage/global_destruction.t index f308765..4fb49cb 100644 --- a/t/storage/global_destruction.t +++ b/t/storage/global_destruction.t @@ -29,7 +29,7 @@ for my $type (qw/PG MYSQL SQLite/) { unless DBIx::Class::Optional::Dependencies->req_ok_for('test_rdbms_mysql'); } - my $schema = DBICTest->connect_schema (@dsn); + my $schema = DBICTest::Schema->connect (@dsn); # emulate a singleton-factory, just cache the object *somewhere in a different package* # to induce out-of-order destruction diff --git a/t/storage/quote_names.t b/t/storage/quote_names.t index 6d9bc76..6492f25 100644 --- a/t/storage/quote_names.t +++ b/t/storage/quote_names.t @@ -105,7 +105,7 @@ for my $db (sort { my $schema; try { - $schema = DBICTest->connect_schema($dsn, $user, $pass, { + $schema = DBICTest::Schema->connect($dsn, $user, $pass, { quote_names => 1 }); $schema->storage->ensure_connected; diff --git a/t/storage/savepoints.t b/t/storage/savepoints.t index 613eb14..0c56afc 100644 --- a/t/storage/savepoints.t +++ b/t/storage/savepoints.t @@ -42,7 +42,7 @@ for ('', keys %$env2optdep) { SKIP: { skip ("Testing with ${prefix}_DSN needs " . DBIx::Class::Optional::Dependencies->req_missing_for( $env2optdep->{$prefix} ), 1) unless DBIx::Class::Optional::Dependencies->req_ok_for($env2optdep->{$prefix}); - $schema = DBICTest->connect_schema ($dsn,$user,$pass,{ auto_savepoint => 1 }); + $schema = DBICTest::Schema->connect ($dsn,$user,$pass,{ auto_savepoint => 1 }); my $create_sql; $schema->storage->ensure_connected; @@ -234,8 +234,6 @@ for ('', keys %$env2optdep) { SKIP: { done_testing; -# XXX: The leak tests fail if this is END compiled before (and thus -# executed after) the one in DBICTest::BaseSchema END { eval { $schema->storage->dbh->do ("DROP TABLE artist") } if defined $schema; undef $schema; diff --git a/t/zzzzzzz_sqlite_deadlock.t b/t/zzzzzzz_sqlite_deadlock.t index 4aa2030..b0e8f3b 100644 --- a/t/zzzzzzz_sqlite_deadlock.t +++ b/t/zzzzzzz_sqlite_deadlock.t @@ -12,7 +12,6 @@ BEGIN { use Test::Exception; use DBICTest; -use DBICTest::Schema; use File::Temp (); plan tests => 2;