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:
|
||||||
ruff format --check .
|
ruff format --check .
|
||||||
|
|
||||||
# Run tests
|
# Run all tests
|
||||||
test:
|
test:
|
||||||
./scripts/run_all_tests.sh
|
pytest
|
||||||
|
|
||||||
# Run SDK tests
|
# Run unit tests only (skip integration)
|
||||||
test-sdk:
|
test-unit:
|
||||||
cd sdk/python && pytest tests -v
|
pytest -m "not integration"
|
||||||
|
|
||||||
# Run backend tests
|
# Run integration tests only
|
||||||
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)
|
|
||||||
test-integration:
|
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",
|
"Programming Language :: Python :: 3.12",
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fastmcp==2.9.2",
|
# Core SDK dependencies
|
||||||
"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
|
|
||||||
"requests>=2.25.0",
|
"requests>=2.25.0",
|
||||||
"urllib3>=1.26.0",
|
"urllib3>=1.26.0",
|
||||||
"aiohttp>=3.8.0",
|
"aiohttp>=3.8.0",
|
||||||
|
# MCP server dependency
|
||||||
|
"fastmcp==2.9.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
@@ -42,11 +38,38 @@ Issues = "https://github.com/omnara-ai/omnara/issues"
|
|||||||
omnara = "servers.mcp_server.stdio_server:main"
|
omnara = "servers.mcp_server.stdio_server:main"
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
include = ["omnara*", "servers", "servers.mcp_server"]
|
include = ["omnara*", "servers.mcp_server*", "servers.shared*"]
|
||||||
|
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
|
# Test discovery
|
||||||
|
testpaths = ["backend/tests", "servers/tests", "tests"]
|
||||||
|
python_files = ["test_*.py"]
|
||||||
|
|
||||||
|
# Markers
|
||||||
markers = [
|
markers = [
|
||||||
"integration: marks tests as integration tests (deselect with '-m \"not integration\"')",
|
"integration: marks tests as integration tests (deselect with '-m \"not integration\"')",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Asyncio support
|
||||||
asyncio_mode = "auto"
|
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
|
#!/bin/bash
|
||||||
# Run all Python tests across the monorepo
|
# Run all Python tests
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Set test environment to disable Sentry
|
echo "🧪 Running Python Tests"
|
||||||
export ENVIRONMENT=test
|
echo "======================"
|
||||||
export SENTRY_DSN=""
|
|
||||||
|
|
||||||
echo "🧪 Running All Python Tests"
|
# Change to root directory
|
||||||
echo "==========================="
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
# Store the root directory (parent of scripts dir)
|
# Run pytest - configuration is in pytest.ini and pyproject.toml
|
||||||
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
pytest "$@"
|
||||||
|
|
||||||
# Function to run tests in a directory if they exist
|
echo -e "\n✅ Tests completed!"
|
||||||
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!"
|
|
||||||
Reference in New Issue
Block a user