Jeremiah Lowin commited on
Commit
b6e3626
·
1 Parent(s): ef61045

Run integration tests as separate CI job on Ubuntu only

Browse files

- Add pytest marker for integration tests
- Configure automatic marking for tests/integration_tests/ folder via pytest hook
- Split CI workflow into two jobs: regular tests (all platforms) and integration tests (Ubuntu only)
- Integration tests can now be retried independently if they fail

.github/workflows/run-tests.yml CHANGED
@@ -46,7 +46,28 @@ jobs:
46
  - name: Install FastMCP
47
  run: uv sync --locked
48
 
49
- - name: Run tests
50
- run: uv run pytest tests
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  env:
52
  FASTMCP_GITHUB_TOKEN: ${{ secrets.FASTMCP_GITHUB_TOKEN }}
 
46
  - name: Install FastMCP
47
  run: uv sync --locked
48
 
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"
72
  env:
73
  FASTMCP_GITHUB_TOKEN: ${{ secrets.FASTMCP_GITHUB_TOKEN }}
pyproject.toml CHANGED
@@ -101,6 +101,15 @@ env = [
101
  'D:FASTMCP_LOG_LEVEL=DEBUG',
102
  'D:FASTMCP_ENABLE_RICH_TRACEBACKS=0',
103
  ]
 
 
 
 
 
 
 
 
 
104
 
105
  [tool.pyright]
106
  include = ["src", "tests"]
 
101
  'D:FASTMCP_LOG_LEVEL=DEBUG',
102
  'D:FASTMCP_ENABLE_RICH_TRACEBACKS=0',
103
  ]
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_*"]
113
 
114
  [tool.pyright]
115
  include = ["src", "tests"]
tests/conftest.py CHANGED
@@ -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)