[Thousand-Oaks-pm] Perl testing issue

Ursetti, Jerry Jerry.Ursetti at wellpoint.com
Thu Nov 8 10:13:38 PST 2012


I figured out how to get make test to work.

I took a guess and removed the -T flag from the test script and 'make test' now works. I think Module::Starter puts that into the 00-load.t test by default.



Jerry Ursetti
  __  __   __
 /_  /  | (_   /\/\
/   /__/  _ ) /    \
Financial Data Systems and Analytics Management
(805)557-4212 (Work)
(805)732-8484 (Blackberry)

From: Thousand-Oaks-pm [mailto:thousand-oaks-pm-bounces+jerry.ursetti=wellpoint.com at pm.org] On Behalf Of Ursetti, Jerry
Sent: Monday, November 05, 2012 11:50 AM
To: thousand-oaks-pm at pm.org
Subject: [Thousand-Oaks-pm] Perl testing issue

I'm hoping some of the Perl test experts in the group can help me out.  I'm trying to do more testing of my modules. I haven't completely made it to TDD, but I am doing more testing. For the most part this is going OK. I've just run into an odd problem that has me stumped.

I'm testing a module that uses one of my other modules. The second module uses the DateTime module and includes code to assign the local timezone to a variable. It sort of works like this:

My module...
...
Use WLP::UTILS;

-          WLP::UTILS module...

o   Use DateTime;

o   our $localtz = DateTime::TimeZone->new( name => 'local' );


I'm having trouble with the most basic test, just trying to use my module:

#!perl -T
use Test::More tests => 1;
BEGIN {
        use_ok( 'WLP::TeradataBTEQ' );
}
diag( "Testing WLP::TeradataBTEQ $WLP::TeradataBTEQ::VERSION, Perl $], $^X" );


When I run 'make test', the test fails with this error:

'Error:  Cannot determine local time zone'

If I run the test script directly, 'perl -T t/00-load.t',  the test passes.

I tried using the $TZ environment variable instead of 'local', in WLP::UTILS. ($TZ is defined in my environment.) That gives me an 'Unknown error' with 'make test' but it still passes when run directly.

The only way I can get this to work with 'make test' is to hardcode the timezone in WLP::UTILS, replacing 'local' with 'PST8PDT'. I really don't want to hardcode this.

It seems like somehow the environment isn't quite right when I run the test via 'make test' so when DateTime tries to get the local timezone, it can't figure it out.

Can I add something to Makefile.PL to make sure the timezone is in the environment? I checked the ExtUtils::MakeMaker pod but didn't see anything obvious that looked like it would set environment variables. I tried looking at the Test::Harness pod and code but didn't see anything there that might help explain what was going wrong, either.

Does anyone have any ideas?

I'm running Perl 5.8.8 on AIX 6.1.

Thanks.

Jerry Ursetti
  __  __   __
 /_  /  | (_   /\/\
/   /__/  _ ) /    \
Financial Data Systems and Analytics Management
(805)557-4212 (Work)
(805)732-8484 (Blackberry)


CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is
for the sole use of the intended recipient(s) and may contain confidential
and privileged information or otherwise be protected by law. Any
unauthorized review, use, disclosure or distribution is prohibited. If you
are not the intended recipient, please contact the sender by reply e-mail
and destroy all copies of the original message.

CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information or otherwise protected by law. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.


CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is
for the sole use of the intended recipient(s) and may contain confidential
and privileged information or otherwise be protected by law. Any
unauthorized review, use, disclosure or distribution is prohibited. If you
are not the intended recipient, please contact the sender by reply e-mail
and destroy all copies of the original message.



CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information or otherwise protected by law. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/thousand-oaks-pm/attachments/20121108/3c908677/attachment.html>


More information about the Thousand-Oaks-pm mailing list