[Jifty-commit] r410 - in jifty/trunk: lib/Jifty lib/Jifty/Script t/Continuations/t t/Mapper/t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Dec 27 18:07:06 EST 2005


Author: alexmv
Date: Tue Dec 27 18:07:06 2005
New Revision: 410

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Script/Model.pm
   jifty/trunk/lib/Jifty/Test.pm
   jifty/trunk/t/Continuations/t/01-raw-api.t
   jifty/trunk/t/Continuations/t/02-api.t
   jifty/trunk/t/Continuations/t/03-gc.t
   jifty/trunk/t/Mapper/t/00-prototype.t
   jifty/trunk/t/Mapper/t/01-raw-api.t
   jifty/trunk/t/Mapper/t/02-api.t

Log:
 r8430 at zoq-fot-pik:  chmrr | 2005-12-27 18:06:33 -0500
  * Only cleanup after tests if they succeeded
  * Add automagic database dropping to after-tests cleanup


Modified: jifty/trunk/lib/Jifty/Script/Model.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Script/Model.pm	(original)
+++ jifty/trunk/lib/Jifty/Script/Model.pm	Tue Dec 27 18:07:06 2005
@@ -58,9 +58,9 @@
     die "You need to give your new model a --name\n"
       unless $model =~ /\w+/;
 
-    # XXX TODO ALEX: This code should be using the config file.
+    Jifty->new( no_handle => 1 );
     my $root = Jifty::Util->app_root;
-    my $appname = Jifty::Util->default_app_name;
+    my $appname = Jifty->config->framework("ApplicationName");
     my $path = "$root/lib/$appname/Model/$model.pm";
 
     my $modelFile = <<"EOT";

Modified: jifty/trunk/lib/Jifty/Test.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Test.pm	(original)
+++ jifty/trunk/lib/Jifty/Test.pm	Tue Dec 27 18:07:06 2005
@@ -159,7 +159,23 @@
 } 
 
 END {
-    unlink mailbox();
+    my $Test = Jifty::Test->builder;
+    # Such a hack -- try to detect if this is a forked copy and don't
+    # do cleanup in that case.
+    return if $Test->{Original_Pid} != $$;
+
+    # If all tests passed..
+    unless (grep {not $_} $Test->summary) {
+        # Clean up mailbox
+        unlink mailbox();
+
+        # Remove testing db
+        Log::Log4perl->get_logger("SchemaTool")->less_logging(3);
+        my $schema = Jifty::Script::Schema->new;
+        $schema->{drop_database} = 1;
+        $schema->run;
+        Log::Log4perl->get_logger("SchemaTool")->more_logging(3);
+    }
 }
 
 1;

Modified: jifty/trunk/t/Continuations/t/01-raw-api.t
==============================================================================
--- jifty/trunk/t/Continuations/t/01-raw-api.t	(original)
+++ jifty/trunk/t/Continuations/t/01-raw-api.t	Tue Dec 27 18:07:06 2005
@@ -10,7 +10,6 @@
 =cut
 
 BEGIN {chdir "t/Continuations"}
-END {unlink Jifty->config->framework('Database')->{'Database'}}
 use lib '../../lib';
 use Jifty::Test tests => 47;
 

Modified: jifty/trunk/t/Continuations/t/02-api.t
==============================================================================
--- jifty/trunk/t/Continuations/t/02-api.t	(original)
+++ jifty/trunk/t/Continuations/t/02-api.t	Tue Dec 27 18:07:06 2005
@@ -10,7 +10,6 @@
 =cut
 
 BEGIN {chdir "t/Continuations"}
-END {unlink Jifty->config->framework('Database')->{'Database'}}
 use lib '../../lib';
 use Jifty::Test tests => 31;
 

Modified: jifty/trunk/t/Continuations/t/03-gc.t
==============================================================================
--- jifty/trunk/t/Continuations/t/03-gc.t	(original)
+++ jifty/trunk/t/Continuations/t/03-gc.t	Tue Dec 27 18:07:06 2005
@@ -5,7 +5,6 @@
 
 # {{{ Setup
 BEGIN {chdir "t/Continuations"}
-END {unlink Jifty->config->framework('Database')->{'Database'}}
 use lib '../../lib';
 use Jifty::Test skip_all => "test file not done yet";
 

Modified: jifty/trunk/t/Mapper/t/00-prototype.t
==============================================================================
--- jifty/trunk/t/Mapper/t/00-prototype.t	(original)
+++ jifty/trunk/t/Mapper/t/00-prototype.t	Tue Dec 27 18:07:06 2005
@@ -10,7 +10,6 @@
 =cut
 
 BEGIN {chdir "t/Mapper"}
-END {unlink Jifty->config->framework('Database')->{'Database'}}
 use lib '../../lib';
 use Jifty::Test tests => 1;
 

Modified: jifty/trunk/t/Mapper/t/01-raw-api.t
==============================================================================
--- jifty/trunk/t/Mapper/t/01-raw-api.t	(original)
+++ jifty/trunk/t/Mapper/t/01-raw-api.t	Tue Dec 27 18:07:06 2005
@@ -10,7 +10,6 @@
 =cut
 
 BEGIN {chdir "t/Mapper"}
-END {unlink Jifty->config->framework('Database')->{'Database'}}
 use lib '../../lib';
 use Jifty::Test tests => 32;
 use_ok('Jifty::Test::WWW::Mechanize');

Modified: jifty/trunk/t/Mapper/t/02-api.t
==============================================================================
--- jifty/trunk/t/Mapper/t/02-api.t	(original)
+++ jifty/trunk/t/Mapper/t/02-api.t	Tue Dec 27 18:07:06 2005
@@ -10,7 +10,6 @@
 =cut
 
 BEGIN {chdir "t/Mapper"}
-END {unlink Jifty->config->framework('Database')->{'Database'}}
 use lib '../../lib';
 use Jifty::Test no_plan => 1;
 


More information about the Jifty-commit mailing list