in reply to Re: Local library for module test script
in thread Local library for module test script

cwd can change, best not to rely on it at all ... I'm frequently inside cwd() of "t" when trying to fix/debug some module, so relying on require "./t/..." would fail

I also often do perl dist-name-version/t/foo.t :) relying on cwd is weak sauce, it can work very often, but its weak practice

  • Comment on Re^2: Local library for module test script

Replies are listed 'Best First'.
Re^3: Local library for module test script
by syphilis (Archbishop) on Dec 03, 2014 at 07:14 UTC
    cwd can change

    Sure, and I have no objection to the approach you suggested.
    However, I write my test suites under the assumption that they're going to be run from "one directory up". If someone complained that they couldn't be run from the 't' directory then I'd likely suggest "stop doing that".

    Cheers,
    Rob
      Well I often have individual tests open in my editor and run them with F5.

      Cheers Rolf

      (addicted to the Perl Programming Language and ☆☆☆☆ :)

      cwd can change Sure, and I have no objection to the approach you suggested. However, I write my test suites under the assumption that they're going to be run from "one directory up". If someone complained that they couldn't be run from the 't' directory then I'd likely suggest "stop doing that". Cheers, Rob

      :) I wouldn't complain to the author, but I would be slightly annoyed and think to myself the author must be an assumer that doesn't understand portability ;)

      In your case syphilis it wouldn't shape my opinion of your skills/care/personality, but for authors I'm less familiar with, it would be something I'd remember :) not give much weight to, but, its a quip :)

        I'm actually amazed that anyone would think that test suite files *ought* to be runnable from everywhere.
        It certainly doesn't hold true for the test files of perl itself and I don't really see that it ought to hold true for perl, perl modules or any other package that contains a test suite.
        But, I guess that those of us who are free to define our own expectations should simply be grateful for that opportunity and not get too carried away when the expectations of others don't quite match our own.

        Cheers,
        Rob