IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4437


Ignore:
Timestamp:
Jun 29, 2005, 3:41:40 PM (21 years ago)
Author:
jhoblitt
Message:

create testing dirs with File::Temp::tempdir()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/t/Test/Nebulous.pm

    r3016 r4437  
    11# Copyright (C) 2004  Joshua Hoblitt
    22#
    3 # $Id: Nebulous.pm,v 1.2 2005-01-15 04:02:12 jhoblitt Exp $
     3# $Id: Nebulous.pm,v 1.3 2005-06-30 01:41:40 jhoblitt Exp $
    44
    55package Test::IData;
     
    1717my $dbh = DBI->connect( $dsn, $user, $passwd );
    1818
    19 #my $dir1 = tempdir( CLEANUP => 0 );
    20 #my $dir2 = tempdir( CLEANUP => 0 );
    21 
    22 my $dir1 = "/tmp/foo1";
    23 my $dir2 = "/tmp/foo1";
    24 
     19# suppress uninitalized warnings
     20my $dir1 = "";
     21my $dir2 = "";
    2522
    2623sub setup {
     
    2926    $self->cleanup;
    3027
    31     mkpath([$dir1, $dir2]);
     28    # create directories after cleanup
     29    $dir1 = tempdir( CLEANUP => 0 );
     30    $dir2 = tempdir( CLEANUP => 0 );
    3231
    3332    local $/ = ';';
     
    5453    $dbh->do( "DROP TABLE IF EXISTS class" );
    5554
    56     rmtree([$dir1, $dir2], 0, 1);
     55    # on the first call to setup the $dir[12] will be ""
     56    rmtree([$dir1], 0, 1) if -e $dir1;
     57    rmtree([$dir2], 0, 1) if -e $dir2;
    5758}
    5859
Note: See TracChangeset for help on using the changeset viewer.