dc6079821b
Docs Tests / Check for file changes (push) Has been cancelled
Docs Tests / Test Documentation (push) Has been cancelled
Docs Tests / Documentation Linting Checks (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-policies) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (ubuntu-24.04, 3.10) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (ubuntu-24.04, 3.8) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (ubuntu-24.04, 3.9) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (windows-2022, 3.10) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (windows-2022, 3.8) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (windows-2022, 3.9) (push) Has been cancelled
Continuous Integration / Check for file changes (push) Has been cancelled
Continuous Integration / Wait for docs tests (push) Has been cancelled
Continuous Integration / Code Quality (push) Has been cancelled
Continuous Integration / Check for changelog (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Upload coverage reports to codeclimate (push) Has been cancelled
Continuous Integration / Run Non-Sequential Integration Tests (push) Has been cancelled
Continuous Integration / Run Broker Integration Tests (push) Has been cancelled
Continuous Integration / Run Sequential Integration Tests (push) Has been cancelled
Continuous Integration / Build Docker base images and setup environment (push) Has been cancelled
Continuous Integration / Build Docker (default) (push) Has been cancelled
Continuous Integration / Build Docker (full) (push) Has been cancelled
Continuous Integration / Build Docker (mitie-en) (push) Has been cancelled
Continuous Integration / Build Docker (spacy-de) (push) Has been cancelled
Continuous Integration / Build Docker (spacy-en) (push) Has been cancelled
Continuous Integration / Build Docker (spacy-it) (push) Has been cancelled
Continuous Integration / Deploy to PyPI (push) Has been cancelled
Continuous Integration / Notify Slack & Publish Release Notes (push) Has been cancelled
Publish Documentation / Evaluate release tag (push) Has been cancelled
Publish Documentation / Prebuild Docs (push) Has been cancelled
Publish Documentation / Preview Docs (push) Has been cancelled
Publish Documentation / Check for file changes (push) Has been cancelled
Publish Documentation / Publish Docs (push) Has been cancelled
Automatic PR Merger / mergepal (push) Has been cancelled
CI Github Actions / Run Tests (push) Has been cancelled
Semgrep / Semgrep Workflow Security Scan (push) Has been cancelled
117 lines
3.2 KiB
Python
117 lines
3.2 KiB
Python
import warnings
|
|
from pathlib import Path
|
|
from typing import Optional, Text
|
|
|
|
import pytest
|
|
|
|
from rasa.cli import scaffold
|
|
from rasa.shared.importers.importer import TrainingDataImporter
|
|
from tests.conftest import filter_expected_warnings
|
|
|
|
|
|
@pytest.mark.flaky
|
|
@pytest.mark.parametrize(
|
|
"config_file, domain_file, data_folder, raise_slot_warning, msg",
|
|
[
|
|
(
|
|
"examples/concertbot/config.yml",
|
|
"examples/concertbot/domain.yml",
|
|
"examples/concertbot/data",
|
|
True,
|
|
None,
|
|
),
|
|
(
|
|
"examples/formbot/config.yml",
|
|
"examples/formbot/domain.yml",
|
|
"examples/formbot/data",
|
|
True,
|
|
None,
|
|
),
|
|
(
|
|
"examples/knowledgebasebot/config.yml",
|
|
"examples/knowledgebasebot/domain.yml",
|
|
"examples/knowledgebasebot/data",
|
|
True,
|
|
"You are using an experimental feature: "
|
|
"Action 'action_query_knowledge_base'!",
|
|
),
|
|
(
|
|
"data/test_moodbot/config.yml",
|
|
"data/test_moodbot/domain.yml",
|
|
"data/test_moodbot/data",
|
|
False,
|
|
None,
|
|
),
|
|
(
|
|
"examples/reminderbot/config.yml",
|
|
"examples/reminderbot/domain.yml",
|
|
"examples/reminderbot/data",
|
|
True,
|
|
None,
|
|
),
|
|
(
|
|
"examples/rules/config.yml",
|
|
"examples/rules/domain.yml",
|
|
"examples/rules/data",
|
|
True,
|
|
None,
|
|
),
|
|
],
|
|
)
|
|
def test_example_bot_training_data_raises_only_auto_fill_warning(
|
|
config_file: Text,
|
|
domain_file: Text,
|
|
data_folder: Text,
|
|
raise_slot_warning: bool,
|
|
msg: Optional[Text],
|
|
):
|
|
|
|
importer = TrainingDataImporter.load_from_config(
|
|
config_file, domain_file, [data_folder]
|
|
)
|
|
|
|
if raise_slot_warning:
|
|
with pytest.warns() as record:
|
|
warnings.simplefilter(action="ignore", category=DeprecationWarning)
|
|
|
|
if msg is not None:
|
|
warnings.filterwarnings(action="ignore", message=msg)
|
|
|
|
importer.get_nlu_data()
|
|
importer.get_stories()
|
|
|
|
assert len(record) == 2
|
|
assert all(
|
|
[
|
|
"Slot auto-fill has been removed in 3.0 and replaced with "
|
|
"a new explicit mechanism to set slots." in r.message.args[0]
|
|
for r in record
|
|
]
|
|
)
|
|
else:
|
|
with warnings.catch_warnings() as record:
|
|
importer.get_nlu_data()
|
|
importer.get_stories()
|
|
|
|
assert record is None
|
|
|
|
|
|
def test_example_bot_training_on_initial_project(tmp_path: Path):
|
|
# we need to test this one separately, as we can't test it in place
|
|
# configuration suggestions would otherwise change the initial file
|
|
scaffold.create_initial_project(str(tmp_path))
|
|
|
|
importer = TrainingDataImporter.load_from_config(
|
|
str(tmp_path / "config.yml"),
|
|
str(tmp_path / "domain.yml"),
|
|
str(tmp_path / "data"),
|
|
)
|
|
|
|
with warnings.catch_warnings() as record:
|
|
importer.get_nlu_data()
|
|
importer.get_stories()
|
|
|
|
if record is not None:
|
|
records = filter_expected_warnings(record)
|
|
assert len(records) == 0
|