Skip to content

Commit

Permalink
some review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
erohmensing committed Dec 16, 2019
1 parent 4ca3d8d commit f13995d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions rasa/cli/interactive.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import argparse
import os
from typing import List, Text
from typing import List, Optional, Text

from rasa.cli import utils
import rasa.cli.train as train
Expand Down Expand Up @@ -90,7 +90,7 @@ def perform_interactive_learning(args: argparse.Namespace, zipped_model: Text) -

with model.unpack_model(zipped_model) as model_path:
args.core, args.nlu = model.get_model_subdirectories(model_path)
if args.nlu is not None and args.core is None:
if args.core is None:
utils.print_error_and_exit(
"Can not run interactive learning on an NLU-only model."
)
Expand Down
2 changes: 1 addition & 1 deletion rasa/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ def unpack_model(
try:
with tarfile.open(model_file, mode="r:gz") as tar:
tar.extractall(working_directory)
logger.debug(f"Extracted model to '{working_directory}'.")
except Exception as e:
logger.error(f"Failed to extract model at {model_file}. Error: {e}")
logger.debug(f"Extracted model to '{working_directory}'.")

return TempDirectoryPath(working_directory)

Expand Down
8 changes: 6 additions & 2 deletions tests/cli/test_rasa_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ def test_train_called_when_no_model_passed(
# Mock actual training and interactive learning methods
mock = Mock()
monkeypatch.setattr(train, "train", mock.train_model)
monkeypatch.setattr(interactive, "perform_interactive_learning", mock.method)
monkeypatch.setattr(
interactive, "perform_interactive_learning", mock.perform_interactive_learning
)

interactive.interactive(args)
mock.train_model.assert_called_once()
Expand Down Expand Up @@ -118,7 +120,9 @@ def test_train_core_called_when_no_model_passed_and_core(
# Mock actual training and interactive learning methods
mock = Mock()
monkeypatch.setattr(train, "train_core", mock.train_core)
monkeypatch.setattr(interactive, "perform_interactive_learning", mock.method)
monkeypatch.setattr(
interactive, "perform_interactive_learning", mock.perform_interactive_learning
)

interactive.interactive(args)
mock.train_core.assert_called_once()
Expand Down

0 comments on commit f13995d

Please sign in to comment.