Skip to content

Commit

Permalink
Merge branch 'master' into random_seed_split
Browse files Browse the repository at this point in the history
  • Loading branch information
joaorobson authored Dec 10, 2019
2 parents 2180c54 + befaa04 commit c5067e8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog/4925.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"rasa init" will ask if user wants to train a model
2 changes: 1 addition & 1 deletion docs/user-guide/evaluating-models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ If you've done this, you can see how well your NLU model predicts the test cases

.. code-block:: bash
rasa test nlu -u test_set.md --model models/nlu-20180323-145833.tar.gz
rasa test nlu -u train_test_split/test_data.md --model models/nlu-20180323-145833.tar.gz
If you don't want to create a separate test set, you can
Expand Down
8 changes: 5 additions & 3 deletions rasa/cli/scaffold.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ def print_train_or_instructions(args: argparse.Namespace, path: Text) -> None:

print_success("Finished creating project structure.")

should_train = questionary.confirm(
"Do you want to train an initial model? 💪🏽"
).skip_if(args.no_prompt, default=True)
should_train = (
questionary.confirm("Do you want to train an initial model? 💪🏽")
.skip_if(args.no_prompt, default=True)
.ask()
)

if should_train:
print_success("Training an initial model...")
Expand Down
9 changes: 9 additions & 0 deletions tests/cli/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ def do_run(*args):
return do_run


@pytest.fixture
def run_with_stdin(testdir: Testdir) -> Callable[..., RunResult]:
def do_run(*args, stdin):
args = ["rasa"] + list(args)
return testdir.run(*args, stdin=stdin)

return do_run


@pytest.fixture
def run_in_default_project(testdir: Testdir) -> Callable[..., RunResult]:
os.environ["LOG_LEVEL"] = "ERROR"
Expand Down
5 changes: 5 additions & 0 deletions tests/cli/test_rasa_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ def test_init_help(run: Callable[..., RunResult]):
assert (
output.outlines[0] == "usage: rasa init [-h] [-v] [-vv] [--quiet] [--no-prompt]"
)


def test_user_asked_to_train_model(run_with_stdin: Callable[..., RunResult]):
run_with_stdin("init", stdin=b"\nYN")
assert not os.path.exists("models")

0 comments on commit c5067e8

Please sign in to comment.