From 41707c1eac506910e378563a16a92fef1e8b0b7c Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 7 Aug 2023 11:59:23 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(test=5Fcli.py):=20refactor?= =?UTF-8?q?=20test=5Fcomponents=5Fpath=20to=20use=20a=20temporary=20direct?= =?UTF-8?q?ory=20for=20components=20path=20=F0=9F=94=A7=20chore(test=5Fcli?= =?UTF-8?q?.py):=20refactor=20test=5Fcomponents=5Fpath=20to=20use=20a=20te?= =?UTF-8?q?mporary=20directory=20for=20components=20path=20to=20improve=20?= =?UTF-8?q?test=20isolation=20and=20avoid=20side=20effects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_cli.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index f1d5f193c..cd2dcdbb7 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,4 +1,5 @@ from pathlib import Path +from tempfile import tempdir from langflow.__main__ import app import pytest @@ -39,11 +40,16 @@ def test_database_url(runner): 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", "./", *default_settings], + ["--components-path", str(temp_dir), *default_settings], ) assert result.exit_code == 0, result.stdout settings_manager = utils.get_settings_manager() - path = Path("./") - assert path in settings_manager.settings.COMPONENTS_PATH + assert temp_dir in settings_manager.settings.COMPONENTS_PATH