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

Bail out if a class extends Test::Class::Moose with a nonexisting/bogus class #93

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@HaraldJoerg
Contributor

HaraldJoerg commented Jul 5, 2018

A module can extend another test module like this:
use Test::Class::Moose extends => 'My::Other::Test::Module';
With this patch, loading fails if My::Other::Test::Module either does not exist at all, or exists but is not a test module (i.e. does not use Test::Class::Moose itself) - instead of silently discarding the test class.
Some tests and a doc update are included.
Closes #70.

@autarch

Thanks for working on this! I'd like to see some changes before I merge this.

Show outdated Hide outdated t/bad_subclass.t
Show outdated Hide outdated t/bad_subclass.t
Show outdated Hide outdated t/bad_subclass.t
Show outdated Hide outdated t/planlib/TestsFor/Attributes/Subclass.pm
Show outdated Hide outdated t/bad_subclass.t
Show outdated Hide outdated t/bad_subclass.t
Show outdated Hide outdated lib/Test/Class/Moose.pm
Show outdated Hide outdated lib/Test/Class/Moose.pm
Show outdated Hide outdated t/bad_subclass.t
Show outdated Hide outdated t/bad_subclass.t
@autarch

This comment has been minimized.

Show comment
Hide comment
@autarch

autarch Jul 7, 2018

Contributor

Also, this needs an entry in the Changes file.

Contributor

autarch commented Jul 7, 2018

Also, this needs an entry in the Changes file.

@HaraldJoerg

This comment has been minimized.

Show comment
Hide comment
@HaraldJoerg

HaraldJoerg Jul 10, 2018

Contributor

So, I hope I have implemented all your suggestions. I have factored out the grammar stuff to formulate the error message in an extra sub because I felt it would distract too much from the usual test workflow. I apologize for the messy git history: I guess I made some mistake and am now unable to clean up.

Contributor

HaraldJoerg commented Jul 10, 2018

So, I hope I have implemented all your suggestions. I have factored out the grammar stuff to formulate the error message in an extra sub because I felt it would distract too much from the usual test workflow. I apologize for the messy git history: I guess I made some mistake and am now unable to clean up.

@autarch

This comment has been minimized.

Show comment
Hide comment
@autarch

autarch Aug 1, 2018

Contributor

Something very weird is happening in this PR. The first three commits appear twice in a row for some weird reason. It might be easiest to make a new branch and cherry pick the commits.

Contributor

autarch commented Aug 1, 2018

Something very weird is happening in this PR. The first three commits appear twice in a row for some weird reason. It might be easiest to make a new branch and cherry pick the commits.

@autarch

See my last comment

@HaraldJoerg

This comment has been minimized.

Show comment
Hide comment
@HaraldJoerg

HaraldJoerg Aug 1, 2018

Contributor

I agree - the mess in this branch is too ugly. New PR coming up in a moment, against your current master branch.

Contributor

HaraldJoerg commented Aug 1, 2018

I agree - the mess in this branch is too ugly. New PR coming up in a moment, against your current master branch.

@autarch

This comment has been minimized.

Show comment
Hide comment
@autarch

autarch Aug 1, 2018

Contributor

No need to close this PR. Just make a new branch of the same name and force push.

Contributor

autarch commented Aug 1, 2018

No need to close this PR. Just make a new branch of the same name and force push.

@HaraldJoerg

This comment has been minimized.

Show comment
Hide comment
@HaraldJoerg

HaraldJoerg Aug 2, 2018

Contributor

Yes, thanks for the hint. I figured out that I could try a force push, and apparently it worked as intended. I had never done this for a PR-related branch before.

So, there's the problem with the Travis checks. I didn't see that issue in my tests with Test2::IPC version 1.302120, but get it after upgrading Test2::IPC to the CPAN version 1.302138 used by Travis.

A short research revealed that it is a known issue in exodist's module, and if I run the test with his git HEAD (July 17) then the warning disappears. So I guess this has to wait until Chad pushes to CPAN.

Contributor

HaraldJoerg commented Aug 2, 2018

Yes, thanks for the hint. I figured out that I could try a force push, and apparently it worked as intended. I had never done this for a PR-related branch before.

So, there's the problem with the Travis checks. I didn't see that issue in my tests with Test2::IPC version 1.302120, but get it after upgrading Test2::IPC to the CPAN version 1.302138 used by Travis.

A short research revealed that it is a known issue in exodist's module, and if I run the test with his git HEAD (July 17) then the warning disappears. So I guess this has to wait until Chad pushes to CPAN.

@autarch

This comment has been minimized.

Show comment
Hide comment
@autarch

autarch Aug 2, 2018

Contributor

I merged this from the CLI with some tweaks. I'll wait for Travis to start passing again before a release.

Contributor

autarch commented Aug 2, 2018

I merged this from the CLI with some tweaks. I'll wait for Travis to start passing again before a release.

@autarch autarch closed this Aug 2, 2018

autarch added a commit that referenced this pull request Aug 15, 2018

v0.93
  [ENHANCEMENTS]

  * The CLI class (and role) now allow you to pass a directory for the
  --classes option. This directory is searched recursively for classes to be
  loaded. Based on a feature request from jrubinator. GH #91.

  [BUG FIXES]

  * Extending a TCM class with a non-existing or non-TCM class now delivers a
    fatal error instead of silently ignoring the test class. Implemented by
    Harald Jörg. PR #93, fixes GH #70.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment