disable connector in tests

This commit is contained in:
Mikhail Epifanov 2024-02-05 23:59:40 +01:00
parent 2a6c13fc5c
commit 16e8c1e8e3
No known key found for this signature in database
3 changed files with 7 additions and 3 deletions

View File

@ -2,7 +2,6 @@ import asyncio
import logging
import multiprocessing
import queue
import weakref
from asyncio import Task
from dataclasses import dataclass
from enum import Enum
@ -50,7 +49,6 @@ class ConnectorManager:
self._queue = multiprocessing.JoinableQueue(maxsize=settings.EXTERNAL_CONNECTORS_QUEUE_SIZE)
self._worker = multiprocessing.Process(target=self.worker, args=(0, self._queue,), daemon=True)
self._worker.start()
self._finalizer = weakref.finalize(self, self.stop)
# Called by post save & post delete signals
def __call__(self, instance: Any, **kwargs) -> None:
@ -138,6 +136,9 @@ class ConnectorManager:
logging.info(f"terminating ConnectionManager worker {worker_id}")
asyncio.set_event_loop(None)
loop.close()
@staticmethod
def get_connected_for_config(config: ConnectorConfig) -> Optional[Connector]:
match config.type:

View File

@ -1,3 +1,5 @@
[pytest]
DJANGO_SETTINGS_MODULE = recipes.settings
python_files = tests.py test_*.py *_tests.py
python_files = tests.py test_*.py *_tests.py
env =
DISABLE_EXTERNAL_CONNECTORS = 1

View File

@ -36,6 +36,7 @@ django-scopes==2.0.0
pytest==7.4.3
pytest-asyncio==0.23.3
pytest-django==4.6.0
pytest-env==1.1.3
django-treebeard==4.7
django-cors-headers==4.2.0
django-storages==1.14.2