Files
mostovik-backend/run_tests.py
Aleksandr Meshchriakov 06b30fca02 feat: implement CI/CD pipeline with Gitea Actions
- Add Gitea Actions workflow with 4 stages: lint, test, build, push
- Configure ruff linting and formatting checks
- Set up Django tests with PostgreSQL and Redis services
- Implement Docker image building for web and celery services
- Add requirements.txt and requirements-dev.txt generation
- Fix ipdb compatibility issues in test runner
- Update ruff configuration for Django compatibility
- Add comprehensive CI/CD documentation
2026-01-19 14:24:48 +01:00

32 lines
1.1 KiB
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python
"""Скрипт для запуска тестов с обходом проблемы ipdb"""
import os
import sys
import django
# Монкипатчим ipdb до импорта Django
sys.modules["ipdb"] = type("MockModule", (), {"__getattr__": lambda s, n: None})()
# Настройка Django
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src"))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.development")
django.setup()
# Теперь можем безопасно импортировать и запускать тесты
from django.core.management import execute_from_command_line
if __name__ == "__main__":
# Добавляем аргументы командной строки
args = sys.argv[1:] # Убираем имя скрипта
if not args:
# По умолчанию запускаем все тесты user app
args = ["test", "apps.user"]
# Подготовка аргументов для Django
django_args = ["manage.py"] + args
sys.argv = django_args
execute_from_command_line(sys.argv)