tests: fix tests by clearing service_manager services (#5573)
* refactor(tests): add new fixtures to files tests - Introduced new pytest fixtures for creating API keys, active users, and flows to streamline test setup. - Updated file upload, download, list, and delete tests to utilize the new fixtures, improving clarity and maintainability. - Ensured that flow IDs are correctly referenced in all file operations, enhancing test accuracy. - Added cleanup logic in fixtures to maintain database integrity after tests. This refactor improves the organization of test cases and ensures that they are more robust and easier to understand. * fix(tests): clear services cache in test fixtures - Added logic to clear the services cache in both `conftest.py` and `test_files.py` fixtures to ensure a clean state for tests. - This change prevents potential interference between tests by resetting the service manager's factories and services before each test run. * refactor(tests): streamline file upload tests and remove unused mocks - Removed the mock implementation of StorageService from the test fixtures to simplify the test setup. - Introduced new fixtures to set maximum file size upload limits, enhancing test flexibility. - Updated file upload, download, and list tests to directly use the new fixtures, improving clarity and maintainability. - Ensured that uploaded file content is accurately tested, reflecting changes in the upload and download logic.
This commit is contained in:
parent
f080049526
commit
8809128d93
2 changed files with 179 additions and 95 deletions
|
|
@ -354,7 +354,11 @@ async def client_fixture(
|
|||
)
|
||||
monkeypatch.setenv("LANGFLOW_LOAD_FLOWS_PATH", load_flows_dir)
|
||||
monkeypatch.setenv("LANGFLOW_AUTO_LOGIN", "true")
|
||||
# Clear the services cache
|
||||
from langflow.services.manager import service_manager
|
||||
|
||||
service_manager.factories.clear()
|
||||
service_manager.services.clear() # Clear the services cache
|
||||
app = create_app()
|
||||
db_service = get_db_service()
|
||||
db_service.database_url = f"sqlite:///{db_path}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue