Test::Class fixture problem
- From: publiustemp-perlqa3@xxxxxxxxx (Ovid)
- Date: Fri, 29 Jun 2007 08:23:15 -0700 (PDT)
I've just spent quite a bit of time debugging a problem where a Test::Class setup method was misbehaving. My tests passed, but mysql was spitting out errors directly to STDERR and quite a bit of tracing led me to the following:
sub setup : Tests(setup) {
my $test = shift;
$test->SUPER::startup;
$test->_make_test_servers(
num_servers => 2,
username => 'Ovid',
);
}
As you can see, I called SUPER::startup instead of SUPER::setup.
My base class has stubs for these methods to ensure that I never have a problem with SUPER::
sub startup : Tests(startup) {}
sub setup : Tests(setup) {}
sub teardown : Tests(teardown) {}
sub shutdown : Tests(shutdown) {}
Sometimes in my hierarchy, though, the SUPER::startup (or whatever) method will call a chain of two of these before getting to the stub. It's trivial to write code in my stubs which check the caller and issue a warning and maybe I can just walk back through the call stack to issue a warning if I'm ever called by an inappropriately named method, but that seems a bit hackish. Is there some better way to solve this problem?
Cheers,
Ovid
--
Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/
.
- Prev by Date: Re: How can i make a perl program lauch another perl program that takes options
- Next by Date: Re: CPU/Memory usage of a process on Windows machine
- Previous by thread: exit code
- Next by thread: how to get references from imbricated capturing parenthesis ?
- Index(es):
Relevant Pages
|
|