Subject: | Fw: Aggregating Catalysts tests |
Date: | Tue, 26 Aug 2008 02:38:08 -0700 (PDT) |
To: | bug-test-aggregate [...] rt.cpan.org |
From: | Ovid <curtis_ovid_poe [...] yahoo.com> |
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://use.perl.org/~Ovid/journal/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
Note: forwarded message attached.
Subject: | Aggregating Catalysts tests |
Date: | Mon, 25 Aug 2008 19:16:27 +0200 |
To: | ovid [...] cpan.org |
From: | Florian Ragwitz <rafl [...] debian.org> |
Message body not shown because it is not plain text.
Hi,
I've been trying to speed up the testsuite of Catalyst-Runtime.
Test::Aggregate was very helpful with that as most of the time seems to
be spent in setting up the test application over and over again in ~50
tests. Doing that only once gave a speedup of about 40%. you++!
However, as Test::Aggregate is marked as alpha software, I'd like to
make aggregating the tests optional. I wanted to make that work with
some Makefile.PL magic. Unfortunately merely requiring Test::Aggregate
makes it emit a plan and exit non-zero because no tests have been run,
which is not what you want in a Makefile.PL.
Would it be possible for you to put the plan() code into import and
not modify the exit status in case there was no plan so I can easily use
require to check for the presence of Test::Aggregate using require?
Another problem I had with aggregating Catalyst tests was the fact that
lots of tests rely on $FindBin::Bin to locate files to be used while
testing things like file uploads. You already set $0 to the name of the
current test, so calling FindBin::again() after doing that sounds like
the right thing to do. The following patch makes all of my aggregated
tests run both with and without Test::Aggregate:
--- lib/Test/Aggregate.pm.orig 2008-08-19 15:45:54.000000000 +0200
+++ lib/Test/Aggregate.pm 2008-08-25 19:12:03.000000000 +0200
@@ -491,7 +491,7 @@
$code .= "\n";
my $set_filenames = $self->_set_filenames
- ? "local \$0 = '$test';"
+ ? "local \$0 = '$test'; my \$reinit_findbin = FindBin->can('again'); \$reinit_findbin->() if \$reinit_findbin;"
: '';
my $see_if_tests_passed = $verbose ? <<" END_CODE" : '';
{
It might be a good idea to also do that at compile time, so
use lib "$FindBin::Bin/...";
will work as expected, but I don't really care about that as I can set
up @INC in the aggregate test file itself.
TIA
--
BOFH excuse #366:
ATM cell has no roaming feature turned on, notebooks can't connect
Message body not shown because it is not plain text.