diff --git a/apps/backend/chatballs/ai/test_demo_provider.py b/apps/backend/chatballs/ai/test_demo_provider.py index 4176569..67b5291 100644 --- a/apps/backend/chatballs/ai/test_demo_provider.py +++ b/apps/backend/chatballs/ai/test_demo_provider.py @@ -9,7 +9,13 @@ from chatballs.ai.runtime import HANDOFF_TOKEN from chatballs.identity.bootstrap import bootstrap_owner from chatballs.identity.models import Organization from chatballs.integrations.models import Integration, IntegrationKind, IntegrationProvider, IntegrationStatus -from chatballs.integrations.services import IntegrationInput, create_integration, test_integration +from chatballs.integrations.services import ( + IntegrationInput, + create_integration, + # Алиас обязателен: имя test_* на уровне модуля pytest собирает как тест + # и падает на ненайденных фикстурах (как в integrations/tests.py). + test_integration as run_integration_test, +) from chatballs.testing import system_tenant_context KNOWLEDGE = ( @@ -73,6 +79,6 @@ class DemoIntegrationTests(TestCase): self.assertEqual(integration.kind, IntegrationKind.LLM_PROVIDER) self.assertEqual(integration.config["default_model"], "demo") self.assertTrue(integration.secret) - checked = test_integration(context=self.context, integration=integration) + checked = run_integration_test(context=self.context, integration=integration) self.assertEqual(checked.status, IntegrationStatus.OK) self.assertIsInstance(_provider_from_integration(Integration.objects.get(pk=integration.pk)), DemoProvider) diff --git a/apps/backend/pytest.ini b/apps/backend/pytest.ini index b8f33dd..9519a89 100644 --- a/apps/backend/pytest.ini +++ b/apps/backend/pytest.ini @@ -1,3 +1,13 @@ [pytest] DJANGO_SETTINGS_MODULE = chatballs_backend.settings python_files = tests.py test_*.py *_tests.py + +# Область сбора. Без неё pytest без аргументов обходит весь каталог backend, +# включая примонтированный media/ с каталогом на каждую организацию: на живой +# установке это сотни тысяч файлов, и сбор падает раньше первого теста +# (OSError: Cannot allocate memory). Тесты живут только в двух пакетах. +testpaths = chatballs chatballs_backend + +# Страховка на случай запуска с явным путём или из другого каталога: +# media и staticfiles — данные и артефакты сборки, тестов там нет. +norecursedirs = media staticfiles .venv node_modules __pycache__ *.egg-info