dc6079821b
CI Github Actions / Run Tests (push) Waiting to run
Automatic PR Merger / mergepal (push) Waiting to run
Semgrep / Semgrep Workflow Security Scan (push) Waiting to run
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
97 lines
3.7 KiB
Python
97 lines
3.7 KiB
Python
import os
|
|
import sys
|
|
from pathlib import Path
|
|
from typing import Callable
|
|
|
|
import pytest
|
|
from _pytest.pytester import RunResult
|
|
|
|
from rasa.shared.constants import ASSISTANT_ID_KEY
|
|
from tests.cli.conftest import RASA_EXE, create_simple_project_with_missing_assistant_id
|
|
|
|
|
|
def test_shell_help(run: Callable[..., RunResult]):
|
|
output = run("shell", "--help")
|
|
|
|
if sys.version_info.minor >= 9:
|
|
# This is required because `argparse` behaves differently on
|
|
# Python 3.9 and above. The difference is the changed formatting of help
|
|
# output for CLI arguments with `nargs="*"
|
|
version_dependent = """[-i INTERFACE] [-p PORT] [-t AUTH_TOKEN] [--cors [CORS ...]]
|
|
[--enable-api] [--response-timeout RESPONSE_TIMEOUT]""" # noqa: E501
|
|
else:
|
|
version_dependent = """[-i INTERFACE] [-p PORT] [-t AUTH_TOKEN]
|
|
[--cors [CORS [CORS ...]]] [--enable-api]
|
|
[--response-timeout RESPONSE_TIMEOUT]"""
|
|
|
|
help_text = (
|
|
f"""usage: {RASA_EXE} shell [-h] [-v] [-vv] [--quiet]
|
|
[--logging-config-file LOGGING_CONFIG_FILE]
|
|
[--conversation-id CONVERSATION_ID] [-m MODEL]
|
|
[--log-file LOG_FILE] [--use-syslog]
|
|
[--syslog-address SYSLOG_ADDRESS]
|
|
[--syslog-port SYSLOG_PORT]
|
|
[--syslog-protocol SYSLOG_PROTOCOL] [--endpoints ENDPOINTS]
|
|
"""
|
|
+ version_dependent
|
|
+ """
|
|
[--remote-storage REMOTE_STORAGE]
|
|
[--ssl-certificate SSL_CERTIFICATE]
|
|
[--ssl-keyfile SSL_KEYFILE] [--ssl-ca-file SSL_CA_FILE]
|
|
[--ssl-password SSL_PASSWORD] [--credentials CREDENTIALS]
|
|
[--connector CONNECTOR] [--jwt-secret JWT_SECRET]
|
|
[--jwt-method JWT_METHOD]
|
|
{nlu} ... [model-as-positional-argument]"""
|
|
)
|
|
|
|
lines = help_text.split("\n")
|
|
# expected help text lines should appear somewhere in the output
|
|
printed_help = {line.strip() for line in output.outlines}
|
|
for line in lines:
|
|
assert line.strip() in printed_help
|
|
|
|
|
|
def test_shell_nlu_help(run: Callable[..., RunResult]):
|
|
output = run("shell", "nlu", "--help")
|
|
|
|
help_text = f"""usage: {RASA_EXE} shell nlu [-h] [-v] [-vv] [--quiet]
|
|
[--logging-config-file LOGGING_CONFIG_FILE] [-m MODEL]
|
|
[model-as-positional-argument]"""
|
|
|
|
lines = help_text.split("\n")
|
|
# expected help text lines should appear somewhere in the output
|
|
printed_help = {line.strip() for line in output.outlines}
|
|
for line in lines:
|
|
assert line.strip() in printed_help
|
|
|
|
|
|
# FIXME: this test passes locally but fails in the CI with timeout > 300s
|
|
@pytest.mark.skip_on_ci
|
|
async def test_shell_without_assistant_id_issues_warning(
|
|
tmp_path: Path, trained_async: Callable, run: Callable[..., RunResult]
|
|
):
|
|
os.environ["LOG_LEVEL"] = "ERROR"
|
|
|
|
create_simple_project_with_missing_assistant_id(tmp_path)
|
|
|
|
domain_path = tmp_path / "domain.yml"
|
|
stories_path = tmp_path / "data" / "stories.yml"
|
|
nlu_path = tmp_path / "data" / "nlu.yml"
|
|
config_path = tmp_path / "config.yml"
|
|
|
|
warning_message = (
|
|
f"The model metadata does not contain a value for the '{ASSISTANT_ID_KEY}' "
|
|
f"attribute. Check that 'config.yml' file contains a value for "
|
|
f"the '{ASSISTANT_ID_KEY}' key and re-train the model."
|
|
)
|
|
|
|
model_path = await trained_async(
|
|
domain=domain_path, config=config_path, training_files=[stories_path, nlu_path]
|
|
)
|
|
|
|
output = run("shell", "--model", str(model_path))
|
|
|
|
printed_output = {line.strip() for line in output.outlines}
|
|
|
|
assert any([warning_message in line for line in printed_output])
|