Permalink
Browse files

Close db handles before trying to remove file

This oversight causes test failures on windows.
  • Loading branch information...
1 parent 3033dfa commit f06daee7dd46c475a1141df5def94904528057d5 @rwstauner committed Dec 27, 2012
Showing with 12 additions and 5 deletions.
  1. +2 −0 Changes
  2. +10 −5 t/module.t
View
@@ -2,6 +2,8 @@ Revision history for App-csv2sqlite
{{$NEXT}}
+ - Fix bug in tests causing failures on MSWin32.
+
0.002 2012-12-22T18:25:19Z
- Add --csv-opt (-o) and --loader-opt (-l) to accept key=value pairs
View
@@ -93,10 +93,12 @@ test_import('csv_opts: alternate separator', {
sub test_import {
my ($desc, $self) = @_;
- subtest $desc, sub {
+subtest $desc, sub {
+ my $db = catfile($dir, 'snacks.sqlite');
+
+ {
my @csvf = map { catfile(corpus => $_) } @{ $self->{csvs} };
- my $db = catfile($dir, 'snacks.sqlite');
my $app = $mod->new_from_argv([ @{ $self->{args} || [] }, @csvf, $db ]);
is_deeply $app->csv_files, [ @csvf ], 'input csv files';
@@ -130,9 +132,12 @@ sub test_import {
'database populated from csv';
}
- #system("sqlite3 $db");
- unlink $db unless $self->{keep_db};
- };
+ }
+
+ # database handles must be cleaned up before removing the db file
+ unlink $db unless $self->{keep_db};
+};
+
}
done_testing;

0 comments on commit f06daee

Please sign in to comment.