Re: Foreign modules in test scripts?

2005-02-21 Thread David Cantrell
Mark Stosberg wrote:
On 2005-02-20, Steffen Schwigon [EMAIL PROTECTED] wrote:
General testing question:
Is it ok for a CPAN module to use other modules from CPAN only for the
test scripts (e.g. Text::Diff)?
Yes.  Just declare them as dependencies.
First, I'm not sure about the usage policy. Maybe it's more common to
write tests more low level.
Why would you write your own buggy code to do complex things in your 
tests, when someone else has already written it and released it on the 
CPAN with tests?  The less code you write, the better.

If you are considered about the extra module requirement for your users,
one option is to distribute the testing modules you want in your own
distribution, in a private 'inc' directory that doesn't get installed.
The practice of bundling third-party modules with yours is IMO very 
wrong indeed.  If I bundle (eg) Test::Frobnitz, and a hundred other 
people bundle Test::Frobnitz, then this leads to two problems:

1. when the author of Test::Frobnitz finds a bug in his code those
   hundred other distributions are still buggy;
2. if a user wants to look at Test::Frobnitz on search.cpan.org it's
   hard to find amongst the noise of old versions in other distributions
Personally, I would probably just the list the module as a dependency,
because that's easy for me.
Not only easier for you, better for your users.
--
David Cantrell


Re: Foreign modules in test scripts?

2005-02-21 Thread Sébastien Aperghis-Tramoni
Selon Michael G Schwern [EMAIL PROTECTED]:

  Second, I know there is a build_requires option in Build.PL, but
  does the CPAN(PLUS).pm know about that option and really only download
  and use those build_requires temporarily during module build/test or
  does it fully install them?

 Something better answered by [EMAIL PROTECTED]  Note that I
 believe CPANPLUS currently defaults to favoring a Makefile.PL over a Build.PL
 if both are present so often it'll just be treated like a normal prereq
 anyway.

Current version of CPANPLUS (0.053) suggests by default to use Build.PL
over Makefile.PL.

--
Sébastien Aperghis-Tramoni

Close the world, txEn eht nepO.


Re: Foreign modules in test scripts?

2005-02-21 Thread Johan Vromans
Andy Lester [EMAIL PROTECTED] writes:

 Is it ok for a CPAN module to use other modules from CPAN only for the
 test scripts (e.g. Text::Diff)?

 Yes.  See http://phalanx.kwiki.org/index.cgi?StandardDotTFiles for
 examples of .t files that only run if a certain module is installed.

Hmm. I don't think that's the problem Steffen has in mind. The
indicated approach works fine for additional tests, but what if your
primary functionality tests require some huge, ugly, non-standard
modules? Or would be much easier to implement with these modules?

I've been in a similar situation with some of my modules that 
require a big amount of test data for verification. While the module
package was some 30Kb, including the test data would increase the size
to megabytes.

-- Johan


Re: Foreign modules in test scripts?

2005-02-21 Thread Michael G Schwern
On Mon, Feb 21, 2005 at 09:34:24AM +, David Cantrell wrote:
 The practice of bundling third-party modules with yours is IMO very 
 wrong indeed.  If I bundle (eg) Test::Frobnitz, and a hundred other 
 people bundle Test::Frobnitz, then this leads to two problems:
 
 1. when the author of Test::Frobnitz finds a bug in his code those
hundred other distributions are still buggy;

If you make use of Module::Install or some other smart do I use the
bundled version or the installed version technique this is not a problem.

Personally, I only bundle a testing module when it avoids a dependency loop
such as Test::Harness or MakeMaker bundling Test::More.


 2. if a user wants to look at Test::Frobnitz on search.cpan.org it's
hard to find amongst the noise of old versions in other distributions

search.cpan.org does not look in the t/ nor inc/ directories so this does
not apply.



Re: Foreign modules in test scripts?

2005-02-21 Thread Barrie Slaymaker
David Cantrell wrote:
The practice of bundling third-party modules with yours is IMO very 
wrong indeed.  If I bundle (eg) Test::Frobnitz, and a hundred other 
people bundle Test::Frobnitz, then this leads to two problems:
Agreed.  See the earlier advice about the inc/ directory so you can 
bundle, but not install.

- Barrie


Re: Foreign modules in test scripts?

2005-02-20 Thread Michael G Schwern
On Sun, Feb 20, 2005 at 02:12:26AM +0100, Steffen Schwigon wrote:
 Is it ok for a CPAN module to use other modules from CPAN only for the
 test scripts (e.g. Text::Diff)?

Up to you.  The way I look at it, if you have one dependency it doesn't
hurt to have another.  Either they're using a CPAN shell and its all
automated or they're not and they're used to lots of pointless extra work.

Alternatively, you can distribute it with your module.  The usual convention
is to copy it into t/lib as t/ is not scanned by search.cpan.org.


 First, I'm not sure about the usage policy. Maybe it's more common to
 write tests more low level.

Again, up to you.  There is no usage policy.  Welcome to CPAN.


 Second, I know there is a build_requires option in Build.PL, but
 does the CPAN(PLUS).pm know about that option and really only download
 and use those build_requires temporarily during module build/test or
 does it fully install them?

Something better answered by [EMAIL PROTECTED]  Note that I
believe CPANPLUS currently defaults to favoring a Makefile.PL over a Build.PL
if both are present so often it'll just be treated like a normal prereq
anyway.

In the end, its not terribly important if an extra module gets installed.
If its easier for you to use the module, use it.  Disk is cheap.  Duplicate
code is extra work and extra bugs.



Foreign modules in test scripts?

2005-02-19 Thread Steffen Schwigon
Hi!

General testing question:

Is it ok for a CPAN module to use other modules from CPAN only for the
test scripts (e.g. Text::Diff)?

First, I'm not sure about the usage policy. Maybe it's more common to
write tests more low level.

Second, I know there is a build_requires option in Build.PL, but
does the CPAN(PLUS).pm know about that option and really only download
and use those build_requires temporarily during module build/test or
does it fully install them?

Thanks,

Steffen 
-- 
Steffen Schwigon [EMAIL PROTECTED]
Dresden Perl Mongers http://dresden-pm.org/


Re: Foreign modules in test scripts?

2005-02-19 Thread Andy Lester
Is it ok for a CPAN module to use other modules from CPAN only for the
test scripts (e.g. Text::Diff)?
Yes.  See http://phalanx.kwiki.org/index.cgi?StandardDotTFiles for 
examples of .t files that only run if a certain module is installed.

xoxo,
Andy
--
Andy Lester = [EMAIL PROTECTED] = www.petdance.com = AIM:petdance


Re: Foreign modules in test scripts?

2005-02-19 Thread Mark Stosberg
On 2005-02-20, Steffen Schwigon [EMAIL PROTECTED] wrote:
 Hi!

 General testing question:

 Is it ok for a CPAN module to use other modules from CPAN only for the
 test scripts (e.g. Text::Diff)?

 First, I'm not sure about the usage policy. Maybe it's more common to
 write tests more low level.

 Second, I know there is a build_requires option in Build.PL, but
 does the CPAN(PLUS).pm know about that option and really only download
 and use those build_requires temporarily during module build/test or
 does it fully install them?

Steffen,

If you are considered about the extra module requirement for your users,
one option is to distribute the testing modules you want in your own
distribution, in a private 'inc' directory that doesn't get installed.

Personally, I would probably just the list the module as a dependency,
because that's easy for me.

Mark

-- 
http://mark.stosberg.com/