Skip to content

Commit

Permalink
Move test_model_not_retrained_if_only_new_responses to acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
radovanZRasa committed Aug 14, 2023
1 parent ff79c55 commit da7f165
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
35 changes: 35 additions & 0 deletions tests/acceptance_tests/test_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from typing import Text

import rasa
from rasa.shared.core.domain import Domain
from rasa.shared.utils.io import write_yaml


def _new_model_path_in_same_dir(old_model_path: Text) -> Text:
Expand All @@ -27,3 +29,36 @@ def test_models_not_retrained_if_no_new_data(
)

assert result.code == 0


def test_dry_run_model_will_not_be_retrained_if_only_new_responses(
trained_e2e_model: Text,
moodbot_domain_path: Path,
e2e_bot_config_file: Path,
e2e_stories_path: Text,
nlu_data_path: Text,
trained_e2e_model_cache: Path,
tmp_path: Path,
):
domain = Domain.load(moodbot_domain_path)
domain_with_extra_response = """
version: '3.1'
responses:
utter_greet:
- text: "Hi from Rasa"
"""
domain_with_extra_response = Domain.from_yaml(domain_with_extra_response)

new_domain = domain.merge(domain_with_extra_response)
new_domain_path = tmp_path / "domain.yml"
write_yaml(new_domain.as_dict(), new_domain_path)

result = rasa.train(
str(new_domain_path),
str(e2e_bot_config_file),
[e2e_stories_path, nlu_data_path],
output=str(tmp_path),
dry_run=True,
)

assert result.code == 0
33 changes: 0 additions & 33 deletions tests/test_model_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,39 +883,6 @@ def test_model_finetuning_with_invalid_model_nlu(
assert "No model for finetuning found" in capsys.readouterr().out


def test_models_not_retrained_if_only_new_responses(
trained_e2e_model: Text,
moodbot_domain_path: Path,
e2e_bot_config_file: Path,
e2e_stories_path: Text,
nlu_data_path: Text,
trained_e2e_model_cache: Path,
tmp_path: Path,
):
domain = Domain.load(moodbot_domain_path)
domain_with_extra_response = """
version: '2.0'
responses:
utter_greet:
- text: "Hi from Rasa"
"""
domain_with_extra_response = Domain.from_yaml(domain_with_extra_response)

new_domain = domain.merge(domain_with_extra_response)
new_domain_path = tmp_path / "domain.yml"
rasa.shared.utils.io.write_yaml(new_domain.as_dict(), new_domain_path)

result = rasa.train(
str(new_domain_path),
str(e2e_bot_config_file),
[e2e_stories_path, nlu_data_path],
output=str(tmp_path),
dry_run=True,
)

assert result.code == 0


def test_models_not_retrained_if_only_new_action(
trained_e2e_model: Text,
moodbot_domain_path: Path,
Expand Down

0 comments on commit da7f165

Please sign in to comment.