Try more patching
This commit is contained in:
parent
a57530e5ac
commit
501d2107a9
1 changed files with 12 additions and 3 deletions
|
|
@ -1,9 +1,10 @@
|
|||
from unittest.mock import patch
|
||||
|
||||
import warnings
|
||||
import pytest
|
||||
|
||||
from cognee.modules.users.methods.get_default_user import get_default_user
|
||||
from cognee.tests.unit.utils.get_mock_user import get_mock_user
|
||||
import sys
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, scope="session")
|
||||
|
|
@ -11,8 +12,16 @@ def set_get_mock_user_wrapper():
|
|||
|
||||
def get_mock_user_wrapper():
|
||||
return get_mock_user(None, None)
|
||||
|
||||
|
||||
for name, module in sys.modules.items():
|
||||
if hasattr(module, 'get_default_user'):
|
||||
warnings.warn(f"Found get_default_user in module: {name}")
|
||||
|
||||
with patch(
|
||||
"cognee.modules.users.methods.get_default_user", get_mock_user_wrapper()
|
||||
):
|
||||
yield
|
||||
with patch(
|
||||
"cognee.modules.users.methods", get_mock_user_wrapper()
|
||||
):
|
||||
with patch('cognee.modules.pipelines.operations.run_tasks', get_mock_user_wrapper()):
|
||||
yield
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue