No such thing as a small change | |
PerlMonks |
Test::More and forkby cees (Curate) |
on Jun 22, 2005 at 16:23 UTC ( [id://469077]=perlquestion: print w/replies, xml ) | Need Help?? |
cees has asked for the wisdom of the Perl Monks concerning the following question: I am having some issues getting Test::More to work properly when the test script needs to fork to do some of the tests. I require this in the test scripts for my Data::FormValidator::Filters::Image module which needs to simulate a file upload. I have the test suite working by just printing "ok 1" directly (See here), but would rather use Test::More if I can. Here is some example code that shows the problem:
The output is as follows:
Notice that the test did execute, and it did print to STDOUT, but Test::More didn't see it, hence it wasn't counted. Here is the same test without using Test::More:
Obviously this second test will just output the simple printed data to STDOUT, but to highlight that it works properly, you can run it through Test::Harness to see that it works OK, and that the Test::More version fails:
I have a feeling this is all because of Test::Builder, which has this comment in the docs: It's ok for your test to change where STDOUT and STDERR point to, Test::Builder's default output settings will not be affected. If that is the problem, is there any way around it? If it isn't the problem, what am I doing wrong?
Back to
Seekers of Perl Wisdom
|
|