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

Use full package name for test functions not imported into test script #123

Merged
merged 1 commit into from Aug 10, 2015

Conversation

Projects
None yet
2 participants
@paultcochrane
Contributor

paultcochrane commented Aug 8, 2015

…t scope

It turns out the workaround I was using to get test functions such as
ok_manifest and all_pod_coverage_ok imported into the current scope so
that when RELEASE_TESTING was set, the modules would be loaded and the
correct functions run. Unfortunately, this was incorrect. All use
statements are run at script compile time (they run in effectively a BEGIN
block). Unfortunately, my testing didn't check the case when the modules
were not locally installed; when the relevant modules (e.g.
Test::CheckManifest) are installed, then everything works fine, both with and
without RELEASE_TESTING. Fortunately, upon working on another pull
request, Travis showed up the issue.

The workaround I'm now using -- since ok_manifest is not seen in the
main scope (due to try_load_class effectively running require and not
use) -- is to use the complete package path to the relevant test
functions. It's not pretty, but it works in the cases I mention above,
namely with and without RELEASE_TESTING and with and without the required
modules being installed.

My apologies for the hassle!

Use full package name for test functions not imported into test scrip…
…t scope

It turns out the workaround I was using to get test functions such as
`ok_manifest` and `all_pod_coverage_ok` imported into the current scope so
that when `RELEASE_TESTING` was set, the modules would be loaded and the
correct functions run.  Unfortunately, this was incorrect.  All `use`
statements are run at script compile time (they run in effectively a `BEGIN`
block).  Unfortunately, my testing didn't check the case when the modules
were not locally installed; when the relevant modules (e.g.
Test::CheckManifest) are installed, then everything works fine, both with and
without `RELEASE_TESTING`.  Fortunately, upon working on another pull
request, Travis showed up the issue.

The workaround I'm now using -- since `ok_manifest` is not seen in the
`main` scope (due to `try_load_class` effectively running `require` and not
`use`) -- is to use the complete package path to the relevant test
functions.  It's not pretty, but it works in the cases I mention above,
namely with and without `RELEASE_TESTING` and with and without the required
modules being installed.

My apologies for the hassle!
@racke

This comment has been minimized.

Show comment
Hide comment
@racke

racke Aug 10, 2015

Owner

Thanks for the fix!

Owner

racke commented Aug 10, 2015

Thanks for the fix!

racke added a commit that referenced this pull request Aug 10, 2015

Merge pull request #123 from paultcochrane/pr/fix-class-load-use-prob…
…lems

Use full package name for test functions not imported into test script

@racke racke merged commit 45c8c63 into racke:master Aug 10, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment