langflow/tests/test_cli.py
Gabriel Luiz Freitas Almeida 59e0bd6e9b 🐛 fix(component.py): change variable name from function_entrypoint_name to _function_entrypoint_name for better readability and consistency
🐛 fix(component.py): fix condition to check if _function_entrypoint_name is empty in Component class

🐛 fix(manager.py): change condition to check if key is in Settings.model_fields.keys() instead of Settings.__fields__.keys() for better accuracy

 feat(settings.py): add support for loading settings from a YAML file and updating settings from YAML and kwargs

🐛 fix(util.py): get "type" or "annotation" from value in get_type function to handle both cases

🐛 fix(test_cli.py): convert temp_dir to string before checking if it is in settings_manager.settings.COMPONENTS_PATH

🐛 fix(test_custom_component.py): change variable name from function_entrypoint_name to _function_entrypoint_name in tests for consistency and remove test for ComponentFunctionEntrypointNameNullError since it is not used anymore

📝 docs(test_llms_template.py): update description of `OpenAI` Chat large language models API in test case
2023-08-20 15:08:06 -03:00

30 lines
795 B
Python

from pathlib import Path
from tempfile import tempdir
from langflow.__main__ import app
import pytest
from langflow.services import utils
@pytest.fixture(scope="module")
def default_settings():
return [
"--backend-only",
"--no-open-browser",
]
def test_components_path(runner, client, default_settings):
# Create a foldr in the tmp directory
temp_dir = Path(tempdir)
# create a "components" folder
temp_dir = temp_dir / "components"
temp_dir.mkdir(exist_ok=True)
result = runner.invoke(
app,
["--components-path", str(temp_dir), *default_settings],
)
assert result.exit_code == 0, result.stdout
settings_manager = utils.get_settings_manager()
assert str(temp_dir) in settings_manager.settings.COMPONENTS_PATH