mirror of
https://github.com/omnara-ai/omnara.git
synced 2025-08-12 20:39:09 +03:00
reduces deps
This commit is contained in:
35
Makefile
35
Makefile
@@ -37,26 +37,23 @@ ruff-check:
|
||||
ruff-format-check:
|
||||
ruff format --check .
|
||||
|
||||
# Run tests
|
||||
# Run all tests
|
||||
test:
|
||||
./scripts/run_all_tests.sh
|
||||
pytest
|
||||
|
||||
# Run SDK tests
|
||||
test-sdk:
|
||||
cd sdk/python && pytest tests -v
|
||||
# Run unit tests only (skip integration)
|
||||
test-unit:
|
||||
pytest -m "not integration"
|
||||
|
||||
# Run backend tests
|
||||
test-backend:
|
||||
cd backend && pytest tests -v || echo "No backend tests yet"
|
||||
|
||||
# Run server tests
|
||||
test-servers:
|
||||
cd servers && pytest tests -v || echo "No server tests yet"
|
||||
|
||||
# Run all tests with coverage
|
||||
test-coverage:
|
||||
cd sdk/python && pytest tests --cov=omnara --cov-report=term-missing
|
||||
|
||||
# Run integration tests with PostgreSQL (requires Docker)
|
||||
# Run integration tests only
|
||||
test-integration:
|
||||
pytest servers/tests/test_integration.py -v -m integration
|
||||
pytest -m integration
|
||||
|
||||
# Run tests with coverage
|
||||
test-coverage:
|
||||
pytest --cov=backend --cov=servers --cov=omnara --cov=shared --cov-report=term-missing
|
||||
|
||||
# Run specific test file or pattern
|
||||
# Usage: make test-k ARGS="test_auth"
|
||||
test-k:
|
||||
pytest -k "$(ARGS)"
|
||||
|
||||
24
conftest.py
Normal file
24
conftest.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""Root-level pytest configuration and shared fixtures."""
|
||||
|
||||
import os
|
||||
import pytest
|
||||
|
||||
# Set test environment
|
||||
os.environ["ENVIRONMENT"] = "test"
|
||||
os.environ["SENTRY_DSN"] = ""
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def test_environment():
|
||||
"""Ensure test environment is set."""
|
||||
original_env = os.environ.copy()
|
||||
|
||||
# Set test environment variables
|
||||
os.environ["ENVIRONMENT"] = "test"
|
||||
os.environ["SENTRY_DSN"] = ""
|
||||
|
||||
yield
|
||||
|
||||
# Restore original environment
|
||||
os.environ.clear()
|
||||
os.environ.update(original_env)
|
||||
@@ -21,16 +21,12 @@ classifiers = [
|
||||
"Programming Language :: Python :: 3.12",
|
||||
]
|
||||
dependencies = [
|
||||
"fastmcp==2.9.2",
|
||||
"sqlalchemy==2.0.23",
|
||||
"psycopg2-binary==2.9.9",
|
||||
"pydantic>=2.5.2",
|
||||
"pydantic-settings>=2.6.1",
|
||||
"python-dotenv>=1.1.0",
|
||||
# SDK dependencies
|
||||
# Core SDK dependencies
|
||||
"requests>=2.25.0",
|
||||
"urllib3>=1.26.0",
|
||||
"aiohttp>=3.8.0",
|
||||
# MCP server dependency
|
||||
"fastmcp==2.9.2",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
@@ -42,11 +38,38 @@ Issues = "https://github.com/omnara-ai/omnara/issues"
|
||||
omnara = "servers.mcp_server.stdio_server:main"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["omnara*", "servers", "servers.mcp_server"]
|
||||
include = ["omnara*", "servers.mcp_server*", "servers.shared*"]
|
||||
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
# Test discovery
|
||||
testpaths = ["backend/tests", "servers/tests", "tests"]
|
||||
python_files = ["test_*.py"]
|
||||
|
||||
# Markers
|
||||
markers = [
|
||||
"integration: marks tests as integration tests (deselect with '-m \"not integration\"')",
|
||||
]
|
||||
|
||||
# Asyncio support
|
||||
asyncio_mode = "auto"
|
||||
asyncio_default_fixture_loop_scope = "function"
|
||||
|
||||
# Basic options
|
||||
addopts = [
|
||||
"-v",
|
||||
"--strict-markers",
|
||||
"--tb=short",
|
||||
]
|
||||
|
||||
[tool.coverage.run]
|
||||
source = ["backend", "servers", "omnara", "shared"]
|
||||
omit = [
|
||||
"*/tests/*",
|
||||
"*/__pycache__/*",
|
||||
"*/migrations/*",
|
||||
"*/alembic/*",
|
||||
]
|
||||
|
||||
[tool.coverage.report]
|
||||
skip_covered = true
|
||||
show_missing = true
|
||||
@@ -1,45 +1,15 @@
|
||||
#!/bin/bash
|
||||
# Run all Python tests across the monorepo
|
||||
# Run all Python tests
|
||||
|
||||
set -e
|
||||
|
||||
# Set test environment to disable Sentry
|
||||
export ENVIRONMENT=test
|
||||
export SENTRY_DSN=""
|
||||
echo "🧪 Running Python Tests"
|
||||
echo "======================"
|
||||
|
||||
echo "🧪 Running All Python Tests"
|
||||
echo "==========================="
|
||||
# Change to root directory
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Store the root directory (parent of scripts dir)
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
# Run pytest - configuration is in pytest.ini and pyproject.toml
|
||||
pytest "$@"
|
||||
|
||||
# Function to run tests in a directory if they exist
|
||||
run_component_tests() {
|
||||
local component=$1
|
||||
local test_dir="$ROOT_DIR/$component"
|
||||
|
||||
if [ -d "$test_dir" ]; then
|
||||
echo -e "\n📦 Testing $component..."
|
||||
cd "$ROOT_DIR" # Stay in root directory
|
||||
|
||||
# Run pytest if tests directory exists
|
||||
if [ -d "$test_dir/tests" ]; then
|
||||
PYTHONPATH="$ROOT_DIR:$PYTHONPATH" pytest "$component/tests" -v
|
||||
else
|
||||
echo " No tests found in $component"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Run tests for each component
|
||||
run_component_tests "backend"
|
||||
run_component_tests "servers"
|
||||
|
||||
# Run root-level integration tests if they exist
|
||||
if [ -d "$ROOT_DIR/tests" ]; then
|
||||
echo -e "\n🌐 Running integration tests..."
|
||||
cd "$ROOT_DIR"
|
||||
pytest tests -v
|
||||
fi
|
||||
|
||||
echo -e "\n✅ All tests completed!"
|
||||
echo -e "\n✅ Tests completed!"
|
||||
Reference in New Issue
Block a user