🔧 chore(test_cli.py): refactor test_components_path to use a temporary directory for components path
🔧 chore(test_cli.py): refactor test_components_path to use a temporary directory for components path to improve test isolation and avoid side effects
This commit is contained in:
parent
d75fb49bf2
commit
41707c1eac
1 changed files with 9 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue