Skip to content

Commit b737fda

Browse files
authored
Merge pull request #1188 from jlowin/separate-integration-tests
2 parents 85ebe5b + 1f06f41 commit b737fda

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

.github/workflows/run-tests.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,28 @@ jobs:
4646
- name: Install FastMCP
4747
run: uv sync --locked
4848

49-
- name: Run tests
50-
run: uv run pytest tests
49+
- name: Run tests (excluding integration)
50+
run: uv run pytest tests -m "not integration"
51+
52+
run_integration_tests:
53+
name: "Run integration tests"
54+
runs-on: ubuntu-latest
55+
timeout-minutes: 10
56+
57+
steps:
58+
- uses: actions/checkout@v4
59+
60+
- name: Install uv
61+
uses: astral-sh/setup-uv@v6
62+
with:
63+
enable-cache: true
64+
cache-dependency-glob: "uv.lock"
65+
python-version: "3.10"
66+
67+
- name: Install FastMCP
68+
run: uv sync --locked
69+
70+
- name: Run integration tests
71+
run: uv run pytest tests -m "integration"
5172
env:
5273
FASTMCP_GITHUB_TOKEN: ${{ secrets.FASTMCP_GITHUB_TOKEN }}

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ env = [
101101
'D:FASTMCP_LOG_LEVEL=DEBUG',
102102
'D:FASTMCP_ENABLE_RICH_TRACEBACKS=0',
103103
]
104+
markers = [
105+
"integration: marks tests as integration tests (deselect with '-m \"not integration\"')",
106+
]
107+
# Automatically mark all tests in integration_tests folder
108+
pythonpath = ["."]
109+
testpaths = ["tests"]
110+
python_files = ["test_*.py", "*_test.py"]
111+
python_classes = ["Test*"]
112+
python_functions = ["test_*"]
104113

105114
[tool.pyright]
106115
include = ["src", "tests"]

tests/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import pytest
2+
3+
4+
def pytest_collection_modifyitems(items):
5+
"""Automatically mark tests in integration_tests folder with 'integration' marker."""
6+
for item in items:
7+
# Check if the test is in the integration_tests folder
8+
if "integration_tests" in str(item.fspath):
9+
item.add_marker(pytest.mark.integration)

0 commit comments

Comments
 (0)