-
Notifications
You must be signed in to change notification settings - Fork 124
Fixed AttributeError when loading CommandSet #980
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #980 +/- ##
=======================================
Coverage 97.82% 97.83%
=======================================
Files 22 22
Lines 4516 4522 +6
=======================================
+ Hits 4418 4424 +6
Misses 98 98
Continue to review full report at Codecov.
|
…ator is loaded during cmd2.Cmd.__init__().
fd31083
to
30d010f
Compare
64555b2
to
6b36d64
Compare
|
||
subcommand_valid, errmsg = self.statement_parser.is_valid_command(subcommand_name, is_subcommand=True) | ||
if not subcommand_valid: | ||
raise CommandSetRegistrationError('Subcommand {} is not valid: {}'.format(str(subcommand_name), errmsg)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding a better error message
@@ -0,0 +1,46 @@ | |||
Testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this section on testing!
Added unit test to verify command name validation updates.
e5a23a4
to
27b1093
Compare
The following error occured when
CommandSet
that usesas_subcommand_to
decorator was loaded duringcmd2.Cmd.__init__()
.The fix was to move the loading code after all
Cmd
attributes have been created.This also added in improved exception message and documentation for testing errors related to poor mocking practices when unit testing.
Closes #981