@@ -, +, @@ processing time for slow servers prove t/DateUtils.t SLOW_SERVER=1 prove t/DateUtils.t --- t/DateUtils.t | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) --- a/t/DateUtils.t +++ a/t/DateUtils.t @@ -75,16 +75,19 @@ isa_ok( $new_dt, 'DateTime', 'Create DateTime with different timezone' ); cmp_ok( $new_dt->ymd(), 'eq', $testdate_iso, 'Returned Dublin object matches input' ); -for ( qw/ 2014-01-01 2100-01-01 9999-01-01 / ) { - my $duration = gettimeofday(); - $new_dt = dt_from_string($_, 'iso', $dear_dirty_dublin); - $duration = gettimeofday() - $duration; - cmp_ok $duration, '<', 2, "Create DateTime with dt_from_string() for $_ with TZ in less than 2s"; - $duration = gettimeofday(); - output_pref( { dt => $new_dt } ); - $duration = gettimeofday() - $duration; - cmp_ok $duration, '<', 2, "Create DateTime with output_pref() for $_ with TZ in less than 2s"; -} +SKIP: { + skip "Don't test execution time of dt_from_string on slow servers", 6 if $ENV{SLOW_SERVER}; + for ( qw/ 2014-01-01 2100-01-01 9999-01-01 / ) { + my $duration = gettimeofday(); + $new_dt = dt_from_string($_, 'iso', $dear_dirty_dublin); + $duration = gettimeofday() - $duration; + cmp_ok $duration, '<', 1, "Create DateTime with dt_from_string() for $_ with TZ in less than 1s"; + $duration = gettimeofday(); + output_pref( { dt => $new_dt } ); + $duration = gettimeofday() - $duration; + cmp_ok $duration, '<', 1, "Create DateTime with output_pref() for $_ with TZ in less than 1s"; + } +}; $new_dt = dt_from_string( '2011-06-16 12:00', 'sql' ); isa_ok( $new_dt, 'DateTime', 'Create DateTime from (mysql) sql' ); --