Update docker-compose and README for Telegram bot integration; add environment file reference and clarify port usage in documentation.
This commit is contained in:
48
tests/test_pytest_config.py
Normal file
48
tests/test_pytest_config.py
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Тест конфигурации pytest
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import os
|
||||
import sys
|
||||
|
||||
def test_pytest_config_loaded():
|
||||
"""Проверяем, что конфигурация pytest загружена"""
|
||||
# Проверяем, что мы находимся в корневой директории проекта
|
||||
assert os.path.exists('pytest.ini'), "pytest.ini должен существовать в корне проекта"
|
||||
|
||||
# Проверяем, что директория tests существует
|
||||
assert os.path.exists('tests'), "Директория tests должна существовать"
|
||||
assert os.path.exists('tests/infra'), "Директория tests/infra должна существовать"
|
||||
assert os.path.exists('tests/bot'), "Директория tests/bot должна существовать"
|
||||
|
||||
def test_import_paths():
|
||||
"""Проверяем, что пути импорта настроены правильно"""
|
||||
# Проверяем, что можем импортировать модули мониторинга
|
||||
sys.path.insert(0, 'infra/monitoring')
|
||||
try:
|
||||
import metrics_collector
|
||||
import message_sender
|
||||
import prometheus_server
|
||||
import server_monitor
|
||||
assert True
|
||||
except ImportError as e:
|
||||
pytest.fail(f"Failed to import monitoring modules: {e}")
|
||||
finally:
|
||||
# Убираем добавленный путь
|
||||
if 'infra/monitoring' in sys.path:
|
||||
sys.path.remove('infra/monitoring')
|
||||
|
||||
def test_test_structure():
|
||||
"""Проверяем структуру тестов"""
|
||||
# Проверяем наличие __init__.py файлов
|
||||
assert os.path.exists('tests/__init__.py'), "tests/__init__.py должен существовать"
|
||||
assert os.path.exists('tests/infra/__init__.py'), "tests/infra/__init__.py должен существовать"
|
||||
assert os.path.exists('tests/bot/__init__.py'), "tests/bot/__init__.py должен существовать"
|
||||
|
||||
# Проверяем наличие тестов инфраструктуры
|
||||
assert os.path.exists('tests/infra/test_infra.py'), "tests/infra/test_infra.py должен существовать"
|
||||
|
||||
if __name__ == "__main__":
|
||||
pytest.main([__file__, "-v"])
|
||||
Reference in New Issue
Block a user