This commit is contained in:
cristhianzl 2024-06-03 15:49:51 -03:00
commit 9d033c9e34
157 changed files with 6860 additions and 5525 deletions

View file

@ -1,4 +1,6 @@
import json
import os.path
import shutil
# we need to import tmpdir
import tempfile
@ -96,6 +98,12 @@ class Config:
result_backend = "redis://localhost:6379/0"
@pytest.fixture(name="load_flows_dir")
def load_flows_dir():
tempdir = tempfile.TemporaryDirectory()
yield tempdir.name
@pytest.fixture(name="distributed_env")
def setup_env(monkeypatch):
monkeypatch.setenv("LANGFLOW_CACHE_TYPE", "redis")
@ -213,7 +221,7 @@ def json_vector_store():
@pytest.fixture(name="client", autouse=True)
def client_fixture(session: Session, monkeypatch, request):
def client_fixture(session: Session, monkeypatch, request, load_flows_dir):
# Set the database url to a test database
if "noclient" in request.keywords:
yield
@ -222,6 +230,11 @@ def client_fixture(session: Session, monkeypatch, request):
db_path = Path(db_dir) / "test.db"
monkeypatch.setenv("LANGFLOW_DATABASE_URL", f"sqlite:///{db_path}")
monkeypatch.setenv("LANGFLOW_AUTO_LOGIN", "false")
if "load_flows" in request.keywords:
shutil.copyfile(pytest.BASIC_EXAMPLE_PATH,
os.path.join(load_flows_dir, "c54f9130-f2fa-4a3e-b22a-3856d946351b.json"))
monkeypatch.setenv("LANGFLOW_LOAD_FLOWS_PATH", load_flows_dir)
monkeypatch.setenv("LANGFLOW_AUTO_LOGIN", "true")
from langflow.main import create_app