From: Rafael Kitover Date: Wed, 30 Dec 2009 20:58:06 +0000 (+0000) Subject: fix tests X-Git-Tag: 0.04999_13~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8b7749d600f77eea279318a0df10a8aaa9fab66b;p=dbsrgits%2FDBIx-Class-Schema-Loader.git fix tests --- diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 5b11376..00c8abd 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -417,7 +417,7 @@ EOF my ($v) = $real_ver =~ /([1-9])/; $v = "v$v"; - last if $v eq CURRENT_V; + last if $v eq CURRENT_V || $real_ver =~ /^0\.04999/; if (not %{ $self->naming }) { warn <<"EOF" unless $ENV{SCHEMA_LOADER_BACKCOMPAT}; diff --git a/t/20invocations.t b/t/20invocations.t index 3c59d9d..9d5ad65 100644 --- a/t/20invocations.t +++ b/t/20invocations.t @@ -28,6 +28,7 @@ my @invocations = ( 'hardcode' => sub { package DBICTest::Schema::5; use base qw/ DBIx::Class::Schema::Loader /; + __PACKAGE__->naming('current'); __PACKAGE__->connection($make_dbictest_db::dsn); __PACKAGE__; }, @@ -35,13 +36,14 @@ my @invocations = ( package DBICTest::Schema::6; use base qw/ DBIx::Class::Schema::Loader /; __PACKAGE__->loader_options(); + __PACKAGE__->naming('current'); __PACKAGE__->connect($make_dbictest_db::dsn); }, 'make_schema_at' => sub { use DBIx::Class::Schema::Loader qw/ make_schema_at /; make_schema_at( 'DBICTest::Schema::7', - { really_erase_my_files => 1 }, + { really_erase_my_files => 1, naming => 'current' }, [ $make_dbictest_db::dsn ], ); DBICTest::Schema::7->clone; @@ -49,6 +51,7 @@ my @invocations = ( 'embedded_options' => sub { package DBICTest::Schema::8; use base qw/ DBIx::Class::Schema::Loader /; + __PACKAGE__->naming('current'); __PACKAGE__->connect( $make_dbictest_db::dsn, { loader_options => { really_erase_my_files => 1 } } @@ -57,6 +60,7 @@ my @invocations = ( 'embedded_options_in_attrs' => sub { package DBICTest::Schema::9; use base qw/ DBIx::Class::Schema::Loader /; + __PACKAGE__->naming('current'); __PACKAGE__->connect( $make_dbictest_db::dsn, undef, @@ -71,7 +75,10 @@ my @invocations = ( { }, [ $make_dbictest_db::dsn, - { loader_options => { really_erase_my_files => 1 } }, + { loader_options => { + really_erase_my_files => 1, + naming => 'current' + } }, ], ); "DBICTest::Schema::10"; @@ -79,7 +86,10 @@ my @invocations = ( 'almost_embedded' => sub { package DBICTest::Schema::11; use base qw/ DBIx::Class::Schema::Loader /; - __PACKAGE__->loader_options( really_erase_my_files => 1 ); + __PACKAGE__->loader_options( + really_erase_my_files => 1, + naming => 'current' + ); __PACKAGE__->connect( $make_dbictest_db::dsn, undef, undef, { AutoCommit => 1 } @@ -89,7 +99,7 @@ my @invocations = ( use DBIx::Class::Schema::Loader; DBIx::Class::Schema::Loader::make_schema_at( 'DBICTest::Schema::12', - { really_erase_my_files => 1 }, + { really_erase_my_files => 1, naming => 'current' }, [ $make_dbictest_db::dsn ], ); DBICTest::Schema::12->clone; diff --git a/t/24loader_subclass.t b/t/24loader_subclass.t index 143c5db..66d24df 100644 --- a/t/24loader_subclass.t +++ b/t/24loader_subclass.t @@ -12,19 +12,21 @@ my %invocations = ( loader_class => sub { package DBICTest::Schema::1; use base qw/ DBIx::Class::Schema::Loader /; + __PACKAGE__->naming('current'); __PACKAGE__->loader_class(shift); __PACKAGE__->connect($make_dbictest_db::dsn); }, connect_info => sub { package DBICTeset::Schema::2; use base qw/ DBIx::Class::Schema::Loader /; + __PACKAGE__->naming('current'); __PACKAGE__->connect($make_dbictest_db::dsn, { loader_class => shift }); }, make_schema_at => sub { use DBIx::Class::Schema::Loader qw/ make_schema_at /; make_schema_at( 'DBICTeset::Schema::3', - { }, + { naming => 'current' }, [ $make_dbictest_db::dsn, { loader_class => shift } ] ); } diff --git a/t/backcompat/0.04006/20invocations.t b/t/backcompat/0.04006/20invocations.t index bd8850b..6060355 100644 --- a/t/backcompat/0.04006/20invocations.t +++ b/t/backcompat/0.04006/20invocations.t @@ -6,6 +6,10 @@ use make_dbictest_db; plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests' unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT}; +local $SIG{__WARN__} = sub { + warn @_ unless $_[0] =~ /Dynamic schema|really_erase_my_files/; +}; + # Takes a $schema as input, runs 4 basic tests sub test_schema { my ($testname, $schema) = @_; diff --git a/t/backcompat/0.04006/22dump.t b/t/backcompat/0.04006/22dump.t index d067a60..fb609d2 100644 --- a/t/backcompat/0.04006/22dump.t +++ b/t/backcompat/0.04006/22dump.t @@ -9,6 +9,11 @@ plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests' my $dump_path = './t/_dump'; +local $SIG{__WARN__} = sub { + warn @_ unless $_[0] =~ + /^Dumping manual schema|really_erase_my_files|^Schema dump complete/; +}; + { package DBICTest::Schema::1; use base qw/ DBIx::Class::Schema::Loader /; diff --git a/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm b/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm index e4e2517..42c53fa 100644 --- a/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm +++ b/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm @@ -88,6 +88,7 @@ sub run_tests { my $warn_count = 0; $warn_count++ if grep /ResultSetManager/, @loader_warnings; + $warn_count++ if grep /Dynamic schema detected/, @loader_warnings; if($self->{skip_rels}) { is(scalar(@loader_warnings), $warn_count) @@ -500,9 +501,17 @@ sub run_tests { q{ INSERT INTO loader_test30 (id,loader_test2) VALUES(321, 2) }, ); - my $dbh = $self->dbconnect(1); - $dbh->do($_) for @statements_rescan; - $dbh->disconnect; + { + # Silence annoying but harmless postgres "NOTICE: CREATE TABLE..." + local $SIG{__WARN__} = sub { + my $msg = shift; + warn $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE}; + }; + + my $dbh = $self->dbconnect(1); + $dbh->do($_) for @statements_rescan; + $dbh->disconnect; + } my @new = $conn->rescan; is(scalar(@new), 1); @@ -852,7 +861,7 @@ sub create { # Silence annoying but harmless postgres "NOTICE: CREATE TABLE..." local $SIG{__WARN__} = sub { my $msg = shift; - print STDERR $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE}; + warn $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE}; }; $dbh->do($_) for (@statements);