Skip Menu |

This queue is for tickets about the Handel CPAN distribution.

Report information
The Basics
Id: 28927
Status: resolved
Priority: 0/
Queue: Handel

People
Owner: claco [...] cpan.org
Requestors:
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.00003
Fixed in: (no value)



Subject: make test fails because of localized exceptions thrown
Hello, When running make test under a french locale, the exception thrown are translated using the default Handel::L10N::fr lexicon. That makes all tests based on e.g. like(shift, qr/not a hash/i, 'not a hash in message'); (from cart_create.t) fail. Regards, Renaud Drousies
Subject: Re: [rt.cpan.org #28927] make test fails because of localized exceptions thrown
Date: Tue, 21 Aug 2007 10:17:31 -0400
To: bug-Handel [...] rt.cpan.org
From: "Christopher H. Laco" <claco [...] chrislaco.com>
Renaud Drousies via RT wrote: Show quoted text
> Tue Aug 21 10:04:26 2007: Request 28927 was acted upon. > Transaction: Ticket created by RDROUSIES > Queue: Handel > Subject: make test fails because of localized exceptions thrown > Broken in: 1.00003 > Severity: (no value) > Owner: Nobody > Requestors: > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=28927 > > > > Hello, > > When running make test under a french locale, the exception thrown are > translated using the default Handel::L10N::fr lexicon. > > That makes all tests based on e.g. > > like(shift, qr/not a hash/i, 'not a hash in message'); (from cart_create.t) > > fail. > > Regards, > Renaud Drousies > >
"ALL", or just "some"? In most cases, where I remembered to, those tests should look like: Show quoted text
> try { > local $ENV{'LANG'} = 'en'; > $storage->create; > > fail('no exception thrown'); > } catch Handel::Exception::Argument with { > pass('argument exception caught'); > like(shift, qr/not a HASH/i, 'not a hash in message'); > } otherwise { > fail('other exception caught'); > };
So, ENV LANG should force these exceptions into English... But, I've been horribly wrong before. :-) Could you send me the output of the failed test numbers, and what your ENV/locale is set to... -=Chris
Download signature.asc
application/pgp-signature 187b

Message body not shown because it is not plain text.

Message body is not shown because it is too large.

Subject: Re: [rt.cpan.org #28927] make test fails because of localized exceptions thrown
Date: Tue, 21 Aug 2007 12:24:49 -0400
To: bug-Handel [...] rt.cpan.org
From: "Christopher H. Laco" <claco [...] chrislaco.com>

Message body is not shown because it is too large.

Download signature.asc
application/pgp-signature 187b

Message body not shown because it is not plain text.

Show quoted text
> > Thanks for the update. That helps a lot. I'll give those a shot > tonight > and see if I can get a 1.00004 out with some other fixes as well. > > -=Chris >
Well, thanks to you for this great framework :) I've enclosed a patch for the test files, if that can save you some time. You can appply it from the main Handel directory with -p0 Regards, Renaud Drousies
diff -Naur t/cart_item_create.t ../Handel-1.00003/t/cart_item_create.t --- t/cart_item_create.t 2007-06-29 22:26:27.000000000 -0400 +++ ../Handel-1.00003/t/cart_item_create.t 2007-08-21 13:39:05.000000000 -0400 @@ -39,6 +39,8 @@ ## test for Handel::Exception::Argument where first param is not a hashref { try { + + local $ENV{'LANG'} = 'en'; my $item = $subclass->create(sku => 'FOO'); fail('no exception thrown'); diff -Naur t/cart_items.t ../Handel-1.00003/t/cart_items.t --- t/cart_items.t 2007-06-29 22:26:27.000000000 -0400 +++ ../Handel-1.00003/t/cart_items.t 2007-08-21 13:39:05.000000000 -0400 @@ -96,6 +96,7 @@ local $ENV{'HandelMaxQuantityAction'} = 'Exception'; try { + local $ENV{'LANG'} = 'en'; $item2->quantity(6); fail('no exception thrown'); diff -Naur t/checkout_plugins.t ../Handel-1.00003/t/checkout_plugins.t --- t/checkout_plugins.t 2007-06-29 22:26:26.000000000 -0400 +++ ../Handel-1.00003/t/checkout_plugins.t 2007-08-21 13:39:05.000000000 -0400 @@ -38,6 +38,7 @@ local $SIG{'__WARN__'} = sub { $warning = shift; }; + local $ENV{'LANG'} = 'en'; is(Handel::Checkout::Plugin->register, undef, 'register does nothing'); like($warning, qr/plugin .* defined register/i, 'warning was set'); }; diff -Naur t/compat_cart_item_new.t ../Handel-1.00003/t/compat_cart_item_new.t --- t/compat_cart_item_new.t 2007-06-29 22:26:26.000000000 -0400 +++ ../Handel-1.00003/t/compat_cart_item_new.t 2007-08-21 13:39:05.000000000 -0400 @@ -18,11 +18,13 @@ use_ok('Handel::Subclassing::CartItem'); use_ok('Handel::Constraints', 'constraint_uuid'); use_ok('Handel::Exception', ':try'); - + + local $ENV{'LANG'} = 'en'; local $SIG{__WARN__} = sub { like(shift, qr/deprecated/); }; use_ok('Handel::Compat'); + }; diff -Naur t/compat_cart_items.t ../Handel-1.00003/t/compat_cart_items.t --- t/compat_cart_items.t 2007-06-29 22:26:28.000000000 -0400 +++ ../Handel-1.00003/t/compat_cart_items.t 2007-08-21 13:39:05.000000000 -0400 @@ -20,6 +20,8 @@ use_ok('Handel::Constants', qw(:cart :returnas)); use_ok('Handel::Exception', ':try'); + local $ENV{'LANG'} = 'en'; + local $SIG{__WARN__} = sub { like(shift, qr/deprecated/); }; diff -Naur t/compat_cart_load.t ../Handel-1.00003/t/compat_cart_load.t --- t/compat_cart_load.t 2007-06-29 22:26:27.000000000 -0400 +++ ../Handel-1.00003/t/compat_cart_load.t 2007-08-21 13:39:05.000000000 -0400 @@ -20,6 +20,8 @@ use_ok('Handel::Constants', qw(:cart :returnas)); use_ok('Handel::Exception', ':try'); + local $ENV{'LANG'} = 'en'; + local $SIG{__WARN__} = sub { like(shift, qr/deprecated/); }; diff -Naur t/compat_cart_new.t ../Handel-1.00003/t/compat_cart_new.t --- t/compat_cart_new.t 2007-06-29 22:26:26.000000000 -0400 +++ ../Handel-1.00003/t/compat_cart_new.t 2007-08-21 13:39:05.000000000 -0400 @@ -21,6 +21,8 @@ use_ok('Handel::Constraints', 'constraint_uuid'); use_ok('Handel::Exception', ':try'); + local $ENV{'LANG'} = 'en'; + local $SIG{__WARN__} = sub { like(shift, qr/deprecated/); }; diff -Naur t/compat_order_item_new.t ../Handel-1.00003/t/compat_order_item_new.t --- t/compat_order_item_new.t 2007-06-29 22:26:26.000000000 -0400 +++ ../Handel-1.00003/t/compat_order_item_new.t 2007-08-21 13:39:05.000000000 -0400 @@ -22,6 +22,8 @@ use_ok('Handel::Constraints', 'constraint_uuid'); use_ok('Handel::Exception', ':try'); + local $ENV{'LANG'} = 'en'; + local $SIG{__WARN__} = sub { like(shift, qr/deprecated/); }; diff -Naur t/compat_order_items.t ../Handel-1.00003/t/compat_order_items.t --- t/compat_order_items.t 2007-06-29 22:26:20.000000000 -0400 +++ ../Handel-1.00003/t/compat_order_items.t 2007-08-21 13:39:05.000000000 -0400 @@ -20,6 +20,8 @@ use_ok('Handel::Constants', qw(:order :returnas)); use_ok('Handel::Exception', ':try'); + local $ENV{'LANG'} = 'en'; + local $SIG{__WARN__} = sub { like(shift, qr/deprecated/); }; diff -Naur t/compat_order_load.t ../Handel-1.00003/t/compat_order_load.t --- t/compat_order_load.t 2007-06-29 22:26:27.000000000 -0400 +++ ../Handel-1.00003/t/compat_order_load.t 2007-08-21 13:39:05.000000000 -0400 @@ -20,6 +20,8 @@ use_ok('Handel::Constants', qw(:order :returnas)); use_ok('Handel::Exception', ':try'); + local $ENV{'LANG'} = 'en'; + local $SIG{__WARN__} = sub { like(shift, qr/deprecated/); }; diff -Naur t/compat_order_new.t ../Handel-1.00003/t/compat_order_new.t --- t/compat_order_new.t 2007-06-29 22:26:27.000000000 -0400 +++ ../Handel-1.00003/t/compat_order_new.t 2007-08-21 13:39:05.000000000 -0400 @@ -55,6 +55,8 @@ use_ok('Handel::Subclassing::OrderOnly'); use_ok('Handel::Subclassing::Cart'); +local $ENV{'LANG'} = 'en'; + local $SIG{__WARN__} = sub { like(shift, qr/deprecated/); }; diff -Naur t/compat.t ../Handel-1.00003/t/compat.t --- t/compat.t 2007-06-29 22:26:25.000000000 -0400 +++ ../Handel-1.00003/t/compat.t 2007-08-21 13:39:05.000000000 -0400 @@ -7,6 +7,7 @@ use lib 't/lib'; use Handel::Test tests => 15; + local $ENV{'LANG'} = 'en'; local $SIG{__WARN__} = sub { like(shift, qr/deprecated/); }; diff -Naur t/storage_primary_columns.t ../Handel-1.00003/t/storage_primary_columns.t --- t/storage_primary_columns.t 2007-06-29 22:26:20.000000000 -0400 +++ ../Handel-1.00003/t/storage_primary_columns.t 2007-08-21 13:39:05.000000000 -0400 @@ -29,6 +29,8 @@ ## throw exception when primary column doesn't exists in columns { try { + + local $ENV{'LANG'} = 'en'; $storage->primary_columns(qw/bar quix/); fail('no exception thrown');
Subject: Re: [rt.cpan.org #28927] make test fails because of localized exceptions thrown
Date: Tue, 21 Aug 2007 14:01:00 -0400
To: bug-Handel [...] rt.cpan.org
From: "Christopher H. Laco" <claco [...] chrislaco.com>
Renaud Drousies via RT wrote: Show quoted text
> Queue: Handel > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=28927 > >
>> Thanks for the update. That helps a lot. I'll give those a shot >> tonight >> and see if I can get a 1.00004 out with some other fixes as well. >> >> -=Chris >>
> > Well, thanks to you for this great framework :) > > I've enclosed a patch for the test files, if that can save you some > time. You can appply it from the main Handel directory with -p0 > > > Regards, > Renaud Drousies > > >
Even better, thanks! When you get further into your project, please stop by the mailing list or IRC and let us know how things are going or if you have any problems. -=Chris
Download signature.asc
application/pgp-signature 187b

Message body not shown because it is not plain text.

Fixed in 1.00004. Applied patch and also changed from LANG to LANGUAGE which seems to cover more setups.