[Jifty-commit] r4072 - in jifty/trunk: lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Sep 10 22:04:45 EDT 2007


Author: jesse
Date: Mon Sep 10 22:04:44 2007
New Revision: 4072

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Test.pm

Log:
 r67094 at pinglin:  jesse | 2007-09-10 18:27:22 -0400
 * When testing, don't just use a single global test database. Instead, use one per testfile. This allows some measure of parallelization


Modified: jifty/trunk/lib/Jifty/Test.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Test.pm	(original)
+++ jifty/trunk/lib/Jifty/Test.pm	Mon Sep 10 22:04:44 2007
@@ -277,10 +277,11 @@
     return {
         framework => {
             Database => {
-                Database => $config->framework('Database')->{Database} . "test",
+                Database => $config->framework('Database')->{Database} . $class->_testfile_to_dbname(),
             },
             Web => {
                 Port => int(rand(5000) + 10000),
+                DataDir => File::Temp::tempdir('masonXXXXXXXXXX')
             },
             Mailer => 'Jifty::Test',
             MailerArgs => [],
@@ -289,6 +290,15 @@
     };
 }
 
+
+sub _testfile_to_dbname {
+    my $dbname = lc($0);
+    $dbname =~ s/\.t$//;
+    $dbname =~ s/[-_\.\/\\]//g;
+    $dbname = substr($dbname,-32,32);	
+    return $dbname;
+}
+
 =head2 make_server
 
 Creates a new L<Jifty::Server> which C<ISA> L<Jifty::TestServer> and


More information about the Jifty-commit mailing list