Skip to content

Commit e466407

Browse files
committed
Modify Tests
1 parent 322c03c commit e466407

7 files changed

Lines changed: 201 additions & 21 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ jobs:
5858
with:
5959
python-version: ${{ matrix.python-version }}
6060
- run: pip install -e ".[dev]"
61-
- run: pytest --cov --cov-report=term-missing
61+
- run: pytest --cov --cov-report=term-missing -n auto

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ format:
55
ruff check --fix .
66

77
test:
8-
. ./.test.sh && pytest --cov --cov-report=term-missing
8+
. ./.test.sh && pytest --cov --cov-report=term-missing -n auto
99

1010
clean-cache:
1111
find . -type d -name "__pycache__" -exec rm -rf {} +

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ dev = [
2626
"pytest>=9.0",
2727
"pytest-asyncio>=1.0",
2828
"pytest-cov>=7.0",
29+
"pytest-xdist>=3.0",
2930
"pre-commit>=4.0",
3031
"types-PyYAML>=6.0",
3132
]
@@ -79,4 +80,7 @@ show_missing = true
7980
fail_under = 0 # TODO
8081

8182
[dependency-groups]
82-
dev = ["pytest-asyncio>=1.3.0"]
83+
dev = [
84+
"pytest-asyncio>=1.3.0",
85+
"pytest-xdist>=3.8.0",
86+
]

src/swiss_ai_model_launch/launchers/firecrest_launcher.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,9 @@ async def get_job_logs(self, job_id: int) -> tuple[str, str]:
186186
err_log = ""
187187

188188
return out_log, err_log
189+
190+
async def cancel_job(self, job_id: int) -> None:
191+
await self.client.cancel_job(
192+
system_name=self.system_name,
193+
jobid=str(job_id),
194+
)

src/swiss_ai_model_launch/launchers/launcher.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ async def get_job_status(self, job_id: int) -> JobStatus: ...
2323

2424
@abstractmethod
2525
async def get_job_logs(self, job_id: int) -> tuple[str, str]: ...
26+
27+
@abstractmethod
28+
async def cancel_job(self, job_id: int) -> None: ...

tests/integration/test_launch_apertus.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,8 @@ async def test_launch_apertus_and_health(
139139
assert isinstance(job_id, int)
140140
assert served_model_name
141141

142-
await _wait_for_job_running(launcher, job_id, launch_timeout)
143-
await _wait_for_model_healthy(served_model_name, cscs_api_key, health_timeout)
142+
try:
143+
await _wait_for_job_running(launcher, job_id, launch_timeout)
144+
await _wait_for_model_healthy(served_model_name, cscs_api_key, health_timeout)
145+
finally:
146+
await launcher.cancel_job(job_id)

uv.lock

Lines changed: 180 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)