Skip Menu |

This queue is for tickets about the JSON-MaybeXS CPAN distribution.

Report information
The Basics
Id: 115394
Status: resolved
Priority: 0/
Queue: JSON-MaybeXS

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

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.003006_001



Subject: Drop Test::Without::Module dependency
Other than Test::Without::Module, I believe JSON::MaybeXS has only core dependencies and the optional dependencies on the backends. (And Cpanel::JSON::XS has minimal dependencies anyway, unlike JSON::XS). Given how trivial the behavior of Test::Without::Module is, it would be nice to drop it (or bundle it in t/lib) to eliminate a test dependency for users that are dependency sensitive. I'm happy to write a patch for either approach.
On 2016-06-17 07:42:26, DAGOLDEN wrote: Show quoted text
> Other than Test::Without::Module, I believe JSON::MaybeXS has only > core dependencies and the optional dependencies on the backends. (And > Cpanel::JSON::XS has minimal dependencies anyway, unlike JSON::XS). > > Given how trivial the behavior of Test::Without::Module is, it would > be nice to drop it (or bundle it in t/lib) to eliminate a test > dependency for users that are dependency sensitive. > > I'm happy to write a patch for either approach.
We could definitely inline the module into t/lib, but it may also be reasonable to simply move these tests into xt/. We'll figure something out on irc.
I cooked up this patch after an IRC discussion with mst. It's effectively a very stripped down equivalent of Devel::Hide.
Subject: 0001-Remove-test-dependency-on-Test-Without-Module.patch
From 01bc1c688cf6a329444b4fbfe425f9406d5ad33a Mon Sep 17 00:00:00 2001 From: David Golden <xdg@xdg.me> Date: Sun, 19 Jun 2016 11:09:44 -0400 Subject: [PATCH] Remove test dependency on Test::Without::Module --- Makefile.PL | 1 - t/legacy.t | 7 ++++++- t/none.t | 14 ++++++++------ t/pp.t | 7 ++++++- t/xs.t | 7 ++++++- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 9ff02cc..1fae27b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -56,7 +56,6 @@ my %WriteMakefileArgs = ( }, test => { requires => { - 'Test::Without::Module' => '0.17', 'Test::More' => '0.88', }, }, diff --git a/t/legacy.t b/t/legacy.t index 20223ec..fb5cc19 100644 --- a/t/legacy.t +++ b/t/legacy.t @@ -1,7 +1,12 @@ use strict; use warnings; -use Test::Without::Module 'Cpanel::JSON::XS'; +# hide Cpanel::JSON::XS +use lib map { + my ( $m, $c ) = ( $_, qq{die "Can't locate $_ (hidden)\n"} ); + sub { return unless $_[1] eq $m; open my $fh, "<", \$c; return $fh } +} qw{Cpanel/JSON/XS.pm}; + use Test::More 0.88; use JSON::MaybeXS qw/:legacy/; diff --git a/t/none.t b/t/none.t index c3d350a..12faf52 100644 --- a/t/none.t +++ b/t/none.t @@ -1,16 +1,18 @@ use strict; use warnings; -use Test::Without::Module 'Cpanel::JSON::XS'; -use Test::Without::Module 'JSON::XS'; -use Test::Without::Module 'JSON::PP'; + +# hide Cpanel::JSON::XS, JSON::XS, JSON::PP +use lib map { + my ( $m, $c ) = ( $_, qq{die "Can't locate $_ (hidden)\n"} ); + sub { return unless $_[1] eq $m; open my $fh, "<", \$c; return $fh } +} qw{Cpanel/JSON/XS.pm JSON/XS.pm JSON/PP.pm}; + use Test::More 0.88; ok(!eval { require JSON::MaybeXS; 1 }, 'Class failed to load'); -# Test::Without::Module always causes 'did not return a true value' errors - like( - $@, qr{Cpanel/JSON/XS.pm did not.*JSON/XS.pm did not.*JSON/PP.pm did not}s, + $@, qr{Can't locate Cpanel/JSON/XS\.pm.*Can't locate JSON/XS\.pm.*Can't locate JSON/PP\.pm}s, 'All errors reported' ); diff --git a/t/pp.t b/t/pp.t index 1d213fb..9aa020f 100644 --- a/t/pp.t +++ b/t/pp.t @@ -1,7 +1,12 @@ use strict; use warnings; -use Test::Without::Module 'Cpanel::JSON::XS', 'JSON::XS'; +# hide Cpanel::JSON::XS, JSON::XS +use lib map { + my ( $m, $c ) = ( $_, qq{die "Can't locate $_ (hidden)\n"} ); + sub { return unless $_[1] eq $m; open my $fh, "<", \$c; return $fh } +} qw{Cpanel/JSON/XS.pm JSON/XS.pm}; + use if !eval { require JSON::PP; 1; }, 'Test::More', skip_all => 'No JSON::PP'; use Test::More 0.88; use JSON::MaybeXS; diff --git a/t/xs.t b/t/xs.t index d57a030..8caa2ad 100644 --- a/t/xs.t +++ b/t/xs.t @@ -1,7 +1,12 @@ use strict; use warnings; -use Test::Without::Module 'Cpanel::JSON::XS'; +# hide Cpanel::JSON::XS +use lib map { + my ( $m, $c ) = ( $_, qq{die "Can't locate $_ (hidden)\n"} ); + sub { return unless $_[1] eq $m; open my $fh, "<", \$c; return $fh } +} qw{Cpanel/JSON/XS.pm}; + use Test::More 0.88; use JSON::MaybeXS; -- 2.8.3
This was applied and shipped in 1.003006_001. thanks!