-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
rasa test core: check if model was provided #6929
Conversation
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!
Let's also add a test for this 👍
"No model provided. Please make sure to specify the model to test with '--model'." | ||
) | ||
return | ||
|
||
if isinstance(args.model, str): | ||
model_path = rasa.cli.utils.get_validated_path( | ||
args.model, "model", DEFAULT_MODELS_PATH |
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.
The default value doesn't make sense then, does it?
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.
It does. The errors happens if args.model = [None]
.
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.
but [None]
already means that there is no model in the DEFAULT_MODELS_PATH
, no?
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.
No. The default value of --model
for rasa test core
is set to the following: https://github.com/RasaHQ/rasa/blob/master/rasa/cli/arguments/test.py#L155
In case there is no model folder, it is set to [None]
. As it is a list of length 1 we extract the first value with is None
. As None
is not of type str
it goes into the else
part, which failed.
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.
So it never got to this line here. This line is used, for example, in rasa test nlu
where you can just have one model path (no list) and this check is working as expected.
Proposed changes:
Check if a model was provided when executing
rasa test core
. If not, print a useful error message and stop.Status (please check what you already did):
black
(please check Readme for instructions)