New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow skipping of initial tests with an environmental variable #12

Merged
merged 3 commits into from Aug 2, 2015

Conversation

Projects
None yet
2 participants
@jmaslak
Contributor

jmaslak commented Aug 2, 2015

First, I'm not sure this is the perfect way to do this, so absolutely use your judgement on whether or not this is the way you want to do it - if it isn't, I'm glad to rework this if you would like a different method of doing something like this. This is one implementation to provide the feature asked for in https://rt.cpan.org/Ticket/Display.html?id=84153 - "I have a project that has a lot of tests, and I'd like to only run the tests as I change code, not a big initial run[.] Could I add a "--watch_only" or some other flag to autoprove that would skip the initial _run_once() call? Would that be an acceptable solution to my problem?"

I thought that the command line already had a lot of stuff on it, so I chose an environmental variable. I structured it so that you could add additional options at a later time, by simply allowing the options in the TEST_CONTINUOUS environmental variable to be separated by commas. The only option defined right now is "SKIP_INITIAL". I also changed documentation to reflect how this works, with a strong suggestion to not do this (since it probably generally shouldn't be done), but there are likely valid uses in really large systems, or in systems where tests take a very long time to run.

I also added a set of new tests in env_variable.t, which try the various combinations of valid and invalid environmental variables, and validate that they do what they should. These tests use Test::Exception, which seems to support all versions of Perl that Test::Continuous does - I added Test::Exception to the tests section of cpanfile (you may want to move Test::More to there; you may also want to add a devel section to cpanfile with Module::Build::AuthorTests and Module::Build::CPANfile listed, since these are required to build the module from the Git repo).

I didn't update the change log, as I don't know if other changes would go out with this, should you agree with this pull request.

@gugod

This comment has been minimized.

Show comment
Hide comment
@gugod

gugod Aug 2, 2015

Owner

I see that this is a patch for RT 84153 -- thank you very much!

Personally I'm like arguments more than introducing one env var for each new features... may I suggest that we take the following approach:

  • Add a autoprove -specific argument. Such as --autoprove-skip-initial -- something that prove does not recognize.
  • Support env var like AUTOPROVE_OPTS or PERL_AUTOPROVE_OPTS that becomes the default list argument list for all invocation of the command.

This idea is just a shameless copy from what cpanm does, and I think it is a brilliant approach to make it convenient for daily uses and still keep all feature easily organized for developers.

Owner

gugod commented Aug 2, 2015

I see that this is a patch for RT 84153 -- thank you very much!

Personally I'm like arguments more than introducing one env var for each new features... may I suggest that we take the following approach:

  • Add a autoprove -specific argument. Such as --autoprove-skip-initial -- something that prove does not recognize.
  • Support env var like AUTOPROVE_OPTS or PERL_AUTOPROVE_OPTS that becomes the default list argument list for all invocation of the command.

This idea is just a shameless copy from what cpanm does, and I think it is a brilliant approach to make it convenient for daily uses and still keep all feature easily organized for developers.

gugod added a commit that referenced this pull request Aug 2, 2015

Merge pull request #12 from jmaslak/watch_only
Allow skipping of initial tests with an environmental variable

@gugod gugod merged commit c949250 into gugod:master Aug 2, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@gugod

This comment has been minimized.

Show comment
Hide comment
@gugod

gugod Aug 2, 2015

Owner

I merged this PR but I would like to rework on it to make autoprove take command-line arugments instead of env vars. So It won't be released as-is, but the feature should be there. Thanks a lot ! 🙇

Owner

gugod commented Aug 2, 2015

I merged this PR but I would like to rework on it to make autoprove take command-line arugments instead of env vars. So It won't be released as-is, but the feature should be there. Thanks a lot ! 🙇

@jmaslak

This comment has been minimized.

Show comment
Hide comment
@jmaslak

jmaslak Aug 2, 2015

Contributor

I'll see what I can do with this today to do exactly like you suggest (which sounds like the right way to do it to me) - both the AUTOPROVE_OPTS and the autoprove-skip-initial command line version.

Contributor

jmaslak commented Aug 2, 2015

I'll see what I can do with this today to do exactly like you suggest (which sounds like the right way to do it to me) - both the AUTOPROVE_OPTS and the autoprove-skip-initial command line version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment