Commit | Line | Data |
d7b94f7a |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | use Test::Exception; |
6 | use lib 't/lib'; |
7 | |
8 | use File::Temp (); |
9 | use DBICTest; |
10 | use DBICTest::Schema; |
11 | |
12 | plan tests => 2; |
13 | my $wait_for = 10; # how many seconds to wait |
14 | |
18b527f8 |
15 | # Fails on mac os *only*. Do not enable |
48d2c1ea |
16 | $TODO = "This seems to be a DBD::SQLite problem, don't test for now"; |
17 | |
d7b94f7a |
18 | for my $close (0,1) { |
19 | |
20 | my $tmp = File::Temp->new( UNLINK => 1, TMPDIR => 1, SUFFIX => '.sqlite' ); |
21 | my $tmp_fn = $tmp->filename; |
22 | close $tmp if $close; |
23 | |
24 | local $SIG{ALRM} = sub { die sprintf ( |
25 | "Timeout of %d seconds reached (tempfile still open: %s)", |
26 | $wait_for, $close ? 'No' : 'Yes' |
27 | )}; |
28 | |
29 | alarm $wait_for; |
30 | |
31 | lives_ok (sub { |
32 | my $schema = DBICTest::Schema->connect ("DBI:SQLite:$tmp_fn"); |
d7b94f7a |
33 | DBICTest->deploy_schema ($schema); |
34 | DBICTest->populate_schema ($schema); |
35 | }); |
36 | |
37 | alarm 0; |
38 | } |