Skip Menu |

This queue is for tickets about the Weather-YR CPAN distribution.

Report information
The Basics
Id: 124573
Status: open
Priority: 0/
Queue: Weather-YR

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

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



Subject: t/20-location-forecast.t started to fail
t/20-location-forecast.t started to fail on my smokers: ... Failed to validate the XML returned from YR.no using schema URL 'http://api.met.no/weatherapi/locationforecast/1.9/schema'; http error : Unknown IO error Schemas parser error : Failed to locate the main schema resource at 'http://api.met.no/weatherapi/locationforecast/1.9/schema'. No XML to generate forecast from! at /home/cpansand/.cpan/build/2018022421/Weather-YR-0.38-GJ59VT/blib/lib/Weather/YR/LocationForecast.pm line 234, <DATA> line 2231. # Failed test 'Number of data points is OK.' # at t/20-location-forecast.t line 25. # got: '0' # expected: '83' Attribute (today) does not pass the type constraint because: Validation failed for 'Weather::YR::LocationForecast::Day' with value undef at reader Weather::YR::LocationForecast::today (defined at /home/cpansand/.cpan/build/2018022421/Weather-YR-0.38-GJ59VT/blib/lib/Weather/YR/LocationForecast.pm line 46) line 15 Weather::YR::LocationForecast::today('Weather::YR::LocationForecast=HASH(0x41ce8870)') called at t/20-location-forecast.t line 26 # Tests were run but no plan was declared and done_testing() was not seen. # Looks like your test exited with 255 just after 1. t/20-location-forecast.t .. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 1/1 subtests ... Looking at the first URL there's now a forced redirect to https, which maybe is not handled by the module properly.
Weather::YR is using XML::LibXML XML::LibXML is just perl bindings for libxml and libxml just does not support https. here is a work-around: https://www.perlmonks.org/?node_id=1064995 Am So 25. Feb 2018, 05:47:37, SREZIC schrieb: Show quoted text
> t/20-location-forecast.t started to fail on my smokers: > > ... > Failed to validate the XML returned from YR.no using schema URL > 'http://api.met.no/weatherapi/locationforecast/1.9/schema'; http error > : Unknown IO error > Schemas parser error : Failed to locate the main schema resource at > 'http://api.met.no/weatherapi/locationforecast/1.9/schema'. > No XML to generate forecast from! at > /home/cpansand/.cpan/build/2018022421/Weather-YR-0.38- > GJ59VT/blib/lib/Weather/YR/LocationForecast.pm line 234, <DATA> line > 2231. > > # Failed test 'Number of data points is OK.' > # at t/20-location-forecast.t line 25. > # got: '0' > # expected: '83' > Attribute (today) does not pass the type constraint because: > Validation failed for 'Weather::YR::LocationForecast::Day' with value > undef at reader Weather::YR::LocationForecast::today (defined at > /home/cpansand/.cpan/build/2018022421/Weather-YR-0.38- > GJ59VT/blib/lib/Weather/YR/LocationForecast.pm line 46) line 15 > Weather::YR::LocationForecast::today('Weather::YR::LocationForecast=HASH(0x41ce8870)') > called at t/20-location-forecast.t line 26 > # Tests were run but no plan was declared and done_testing() was not > seen. > # Looks like your test exited with 255 just after 1. > t/20-location-forecast.t .. > Dubious, test returned 255 (wstat 65280, 0xff00) > Failed 1/1 subtests > ... > > > Looking at the first URL there's now a forced redirect to https, which > maybe is not handled by the module properly.
here is the quick an dirty fix I came up with to make it pass the tests again. --- /root/.cpanm/work/1520112454.27147/Weather-YR-0.38/lib/Weather/YR/Base.pm 2016-05-27 11:48:39.000000000 +0200 +++ /root/.cpanm/work/1520112103.14108/Weather-YR-0.38/lib/Weather/YR/Base.pm 2018-03-06 13:48:37.297635760 +0100 @@ -14,7 +14,7 @@ isa => 'Mojo::URL', is => 'ro', lazy => 1, - default => sub { Mojo::URL->new('http://api.met.no') }, + default => sub { Mojo::URL->new('https://api.met.no') }, ); has [ 'lat', 'lon', 'msl' ] => ( @@ -79,7 +79,8 @@ if ( $self->can('schema_url') ) { eval { my $xml_doc = XML::LibXML->new->load_xml( string => $self->xml ); - my $schema = XML::LibXML::Schema->new( location => $self->schema_url ); + my $response = $self->ua->get( $self->schema_url->to_string ); + my $schema = XML::LibXML::Schema->new( string => $response->decoded_content ); $schema->validate( $xml_doc ); };