-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
GitHub CI
committed
Aug 14, 2023
1 parent
13a4600
commit 6d8a523
Showing
10 changed files
with
158 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Tests | ||
This directory contains all tests for the projects. | ||
Tests are organized into several groups: | ||
* unit tests and integration tests | ||
* regression tests | ||
* acceptance tests | ||
|
||
### Unit tests and integration tests | ||
These are executed by our CI for every Pull Request. | ||
They are located in all directories except `tests/regression` and `tests/acceptance_tests`. | ||
|
||
### Regression tests | ||
These are executed by our CI before every release. | ||
They are located in the `tests/regressions` directory. | ||
|
||
### Acceptance tests | ||
These are executed by our CI before every release. | ||
They are located in the `tests/acceptance_tests` directory. |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
from pathlib import Path | ||
import secrets | ||
|
||
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: | ||
return str(Path(old_model_path).parent / (secrets.token_hex(8) + ".tar.gz")) | ||
|
||
|
||
def test_models_not_retrained_if_no_new_data( | ||
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, | ||
): | ||
result = rasa.train( | ||
str(moodbot_domain_path), | ||
str(e2e_bot_config_file), | ||
[e2e_stories_path, nlu_data_path], | ||
output=_new_model_path_in_same_dir(trained_e2e_model), | ||
dry_run=True, | ||
) | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters