sergot / http-useragent

Web user agent class for Perl 6.
MIT License
36 stars 39 forks source link

Currently can't run test scripts individually #217

Closed jonathanstowe closed 5 years ago

jonathanstowe commented 5 years ago

I think this is to do with a recent change in rakudo but putting it here as a reminder.

In the 06c03a7a I fully qualified the use of HTTP::Request and HTTP::Response so as not to conflict with the similarly named classes in HTTP::Server - this has worked for two and a half years but with the

This is Rakudo version 2018.12-250-g8095ceada built on MoarVM version 2018.12-36-g34fac5f4e
implementing Perl 6.d.

We now get:

[jonathan@coriolanus http-useragent]$ perl6 -Ilib t/270-issue-212.t 
===SORRY!===
Could not find HTTP::Response:auth<github:sergot> at line 3 in:
    /home/jonathan/devel/perl6/3rdparty-modules/http-useragent/lib
    /home/jonathan/.perl6
    /home/jonathan/.rakudobrew/moar-master/install/share/perl6/site
    /home/jonathan/.rakudobrew/moar-master/install/share/perl6/vendor
    /home/jonathan/.rakudobrew/moar-master/install/share/perl6
    CompUnit::Repository::AbsolutePath<67303216>
    CompUnit::Repository::NQP<40916384>
    CompUnit::Repository::Perl5<40916424>

I guess the easiest thing to do would be to remove the auth qualification but that would put back the conflict with the HTTP::Server. The better solution would be to rename the classes under the HTTP::UserAgent package but that is likely to break existing code in the wild.

Can classes be deprecated like routines? If so it could be rename the classes but leave the existing ones as stubs with the deprecation and then remove them in a month or so.

UPDATE

Of course the correct way now to run the tests individually is with

[jonathan@coriolanus http-useragent]$ perl6 -I. t/270-issue-212.t 
1..1
# NETWORK_TESTING was not set
ok 1 - # SKIP NETWORK_TESTING was not set

So it can use the provides in the META file.

ugexe commented 5 years ago

So the issue is that auth for a dist not pointing at a META6.json is '' (and the version * and the api *). It may end up that an auth of '' will match against any other auth, but I still have to think about the ramifications.

Either way, I would always suggest using -I. instead of -Ilib. Consider if a dependency does use HTTP::UserAgent:ver<Some-Old-Version>... the -Ilib repo would pick this up because its version will be *, when in reality we wanted it to load the installed older version.

I think the following would work for both -I. and -Ilib -- for post and pre 2019.01: use HTTP::Response:auth(try EVAL q[$?DISTRIBUTION.meta<auth>] // 'github:sergot')