Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Test dependency problem in Graphics::Fig

by scooter (Initiate)
on Aug 07, 2021 at 02:09 UTC ( #11135665=perlquestion: print w/replies, xml ) Need Help??

scooter has asked for the wisdom of the Perl Monks concerning the following question:

I recently uploaded Graphics::Fig v1.0.5 to fix a defect, and am now getting error reports from the testers. The problem is that the tests aren't finding an internal test module, t/ I've worked around these test dependency problems before by creating symbolic links in the source directory. But I notice that when I do that, MakeMaker "make manifest" follows the links and puts duplicate source files into the distribution. I probably introduced this new dependency problem by removing one of the links.

What is the "right" way to get the tests to find both the modules they're testing, and also any internal test modules?

  • Comment on Test dependency problem in Graphics::Fig

Replies are listed 'Best First'.
Re: Test dependency problem in Graphics::Fig
by haukex (Bishop) on Aug 07, 2021 at 04:04 UTC

    When my t/*.t scripts need to find t/*.pm files, I use use FindBin (); use lib $FindBin::Bin; in the .t files. I've seen a few other approaches but this one has been working reliably for me.

      Tests passed this time. Thanks.
Re: Test dependency problem in Graphics::Fig
by Corion (Patriarch) on Aug 07, 2021 at 07:43 UTC

    For my test programs with a test helper library in t/ I use something like

    use lib 't/'; use MyTestHelper;

    This picks up the library when the tests are run using make test or prove.

Re: Test dependency problem in Graphics::Fig
by perlfan (Vicar) on Aug 08, 2021 at 02:35 UTC
    prove's -l (lowercase "L") appends ./lib to @INC. So, prove -l, might do what you want. Similarly, prove -It/lib would work for you it seems. That said, .pm files in ./t should probably be in ./t/lib or /xlib. Using Dist::Zilla, you could also have a proper lib/Test/ namespace, then strip out what you don't want to include in the actual distribution. YMMV

      I think s/appends/prepends/. Itís common to have multiple versions of a module or a core version in system perl or in local::lib orÖ so the distinction matters since @INC is searched in order.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11135665]
Approved by Athanasius
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2022-05-26 02:22 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (92 votes). Check out past polls.