From: Rafael Kitover Date: Sun, 24 Jun 2012 05:32:03 +0000 (-0400) Subject: mark some tests in admin/10script.t on Win32 TODO X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a036182226af9edc62ef393cebca797030f44a9a;p=dbsrgits%2FDBIx-Class-Historic.git mark some tests in admin/10script.t on Win32 TODO The test_dbicadmin() tests are failing on Win32 due to some sort of quoting issue with the temp directory. I'm not sure how the temp directory is being used here, so it will have to wait for someone else, in the meanwhile I marked the tests TODO. Also changed the " backwhacking to use Win32::ShellQuote instead and added it to optdeps, unfortunately that didn't fix the problem, since the problem seems to be some sort of DBICTest::RunMode interaction with dbicadmin. --- diff --git a/lib/DBIx/Class/Optional/Dependencies.pm b/lib/DBIx/Class/Optional/Dependencies.pm index b8708b6..b03ef9c 100644 --- a/lib/DBIx/Class/Optional/Dependencies.pm +++ b/lib/DBIx/Class/Optional/Dependencies.pm @@ -32,6 +32,13 @@ my $admin_basic = { 'namespace::autoclean' => '0.09', }; +my $admin_script = { + %$moose_basic, + %$admin_basic, + 'Getopt::Long::Descriptive' => '0.081', + 'Text::CSV' => '1.16', +}; + my $datetime_basic = { 'DateTime' => '0.55', 'DateTime::Format::Strptime' => '1.2', @@ -131,10 +138,7 @@ my $reqs = { admin_script => { req => { - %$moose_basic, - %$admin_basic, - 'Getopt::Long::Descriptive' => '0.081', - 'Text::CSV' => '1.16', + %$admin_script, }, pod => { title => 'dbicadmin', @@ -142,6 +146,13 @@ my $reqs = { }, }, + test_admin_script => { + req => { + %$admin_script, + ($^O eq 'MSWin32' ? ('Win32::ShellQuote' => 0) : ()), + } + }, + deploy => { req => { 'SQL::Translator' => '0.11006', diff --git a/t/admin/10script.t b/t/admin/10script.t index 8572ca1..d84a579 100644 --- a/t/admin/10script.t +++ b/t/admin/10script.t @@ -8,9 +8,10 @@ use lib qw(t/lib); use DBICTest; BEGIN { - require DBIx::Class; - plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for('admin_script') - unless DBIx::Class::Optional::Dependencies->req_ok_for('admin_script'); + require DBIx::Class; + plan skip_all => 'Test needs ' . + DBIx::Class::Optional::Dependencies->req_missing_for('test_admin_script') + unless DBIx::Class::Optional::Dependencies->req_ok_for('test_admin_script'); } $ENV{PATH} = ''; @@ -33,16 +34,20 @@ cmp_ok ( $? >> 8, '==', 70, 'Correct exit code from connecting a custom INC sche test_exec(qw|-It/lib/testinclude --schema=DBICTestConfig --config=t/lib/admincfgtest.json --config-stanza=Model::Gort --deploy|); cmp_ok ($? >> 8, '==', 71, 'Correct schema loaded via testconfig'); -for my $js (@json_backends) { +TODO: { + local $TODO = 'these tests need to be fixed for Win32' if $^O eq 'MSWin32'; - eval {JSON::Any->import ($js) }; - SKIP: { - skip ("JSON backend $js is not available, skip testing", 1) if $@; + for my $js (@json_backends) { - $ENV{JSON_ANY_ORDER} = $js; - eval { test_dbicadmin () }; - diag $@ if $@; - } + eval {JSON::Any->import ($js) }; + SKIP: { + skip ("JSON backend $js is not available, skip testing", 1) if $@; + + $ENV{JSON_ANY_ORDER} = $js; + eval { test_dbicadmin () }; + diag $@ if $@; + } + } } done_testing(); @@ -90,23 +95,15 @@ sub default_args { ); } -# Why do we need this crap? Apparently MSWin32 can not pass through quotes properly -# (sometimes it will and sometimes not, depending on what compiler was used to build -# perl). So we go the extra mile to escape all the quotes. We can't also use ' instead -# of ", because JSON::XS (proudly) does not support "malformed JSON" as the author -# calls it. Bleh. -# sub test_exec { my ($perl) = $^X =~ /(.*)/; - my @args = ('script/dbicadmin', @_); + my @args = ($perl, '-MDBICTest::RunMode', 'script/dbicadmin', @_); - if ( $^O eq 'MSWin32' ) { - $perl = qq|"$perl"|; # execution will fail if $^X contains paths - for (@args) { - $_ =~ s/"/\\"/g; - } + if ($^O eq 'MSWin32') { + require Win32::ShellQuote; # included in test optdeps + @args = Win32::ShellQuote::quote_system_list(@args); } - system ($perl, '-MDBICTest::RunMode', @args); + system @args; }