Comments (5)
Since I just ran into this issue with another project again, here's the Test::Critic::Perl-relevant part of my analysis on the culprit as posted in the mentioned Debian bug report back then:
I'm actually not sure if the bug is really in Test::Perl::Critic. We actually [have several] options where the bug could be:
- [Skipping solutions in affected packages]
- libtest-simple-perl: Test::More's
subtest
, because it doesn't seem to be thread-safe.- libmce-perl: MCE::Grep's
mce_grep
seems to have no option to enforce the using of plaingrep
upon request.- libtest-perl-critic-perl, because Test::Perl::Critic uses
mce_grep
unconditionally (replacing it with plaingrep
solves the issue, too.) and its fiddling with Test::Builder's internals ignores$builder->{Test_Results}
which is used bysubtest
.So a working and tested patch is the following:
diff --git a/lib/Test/Perl/Critic.pm b/lib/Test/Perl/Critic.pm index 2fdf32b..021e0f7 100644 --- a/lib/Test/Perl/Critic.pm +++ b/lib/Test/Perl/Critic.pm @@ -101,7 +101,7 @@ sub all_critic_ok { # workers. So we disable the T::B sanity checks at the end of its life. $TEST->no_ending(1); - my $okays = mce_grep { critic_ok($_) } @files; + my $okays = grep { critic_ok($_) } @files; my $pass = $okays == @files; # To make Test::Harness happy, we must emit a test plan and a sensible exitI was tempted to apply that patch [in Debian] and upload it […] but this removes all gain which was added by using MCE::Grep, so that's likely not the right solution. [This] is something upstream must fix — if it is a bug in Test::Perl::Critic at all.
from test-perl-critic.
Can someone please describe the problem? I'm seeing all these code examples, but I don't understand what you're seeing.
What is the behavior you're seeing and what are you expecting it to be doing instead?
from test-perl-critic.
Embedding all_critic_ok(…);
inside a Test::More 'subtest "test name", sub { …; }' always fails despite the tests by all_critic_ok(…);
were ok and that work around should have helped against all_critic_ok()
calling its own done_testing()
or equivalent. (And it didn't do that in the past.)
I might come up with a full working example later, if the above explanation doesn't suffice.
from test-perl-critic.
I suspect this is corrected by the fix to #9
I tested it with and without MCE and both permutations work
Test file below:
use Test::More;
use Test::Perl::Critic;
my @libs = qw!/home/eadjei/lib_1/ /home/eadjei/cvl/lib_2/!;
for my $lib( @libs ){
subtest "Critic all code in $lib" => sub {
all_critic_ok($lib);
done_testing;
};
}
done_testing;
from test-perl-critic.
from test-perl-critic.
Related Issues (11)
- Please make the MCE dependency optional HOT 12
- Perl::Critic being instantiated for each file is very slow HOT 2
- Support external perlcritic command? HOT 2
- wishlist: Option to allow excluding some files HOT 1
- Test::Builder needs to be at least version 0.88
- Fresh install fails to install PPI because of missing File::Remove dependency HOT 2
- should require newer version of MCE HOT 1
- Issues link in POD is wrong HOT 3
- Wishlist: better use of PPI::Cache
- critic_ok() in xt/96_perlcritic.t doesn't work with MCE running HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from test-perl-critic.