Skip to content

Commit 8c9d7db

Browse files
fix: Apply pre-commit formatting and linting fixes
- Remove trailing whitespace from CI workflow, noxfile, and tox.ini - Add newline at end of tox.ini - Reformat assert statements in tests for better readability - Apply ruff formatting standards across all files
1 parent 35f0ef8 commit 8c9d7db

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
python-version: ${{ matrix.python-version }}
7777
- name: Install dependencies
7878
run: pipx install pdm && pipx install nox
79-
- name: Run OpenLLM async tests
79+
- name: Run OpenLLM async tests
8080
run: nox --session openllm-async-${{ matrix.python-version }}
8181
- name: Disambiguate coverage filename
8282
run: mv .coverage ".coverage.async-patterns.${{ matrix.os }}.${{ matrix.python-version }}"

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def run_async_llm_pattern_tests(session: nox.Session):
123123
)
124124

125125

126-
@nox.session(name="transformers-async-local", python=PYTHON_VERSIONS)
126+
@nox.session(name="transformers-async-local", python=PYTHON_VERSIONS)
127127
def run_transformers_async_tests_local(session: nox.Session):
128128
"""Run full transformers async tests locally (not in CI due to resource constraints)."""
129129
session.run("pdm", "sync", "-G", "testing", external=True)

tests/unit/test_openllm_run.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ async def test_run_async_concurrent(self):
8585
assert "generated_text" in result
8686

8787
# Performance requirement: complete within 60 seconds
88-
assert (
89-
elapsed_time < 60
90-
), f"Async operations took {elapsed_time:.2f}s, exceeding 60s limit"
88+
assert elapsed_time < 60, (
89+
f"Async operations took {elapsed_time:.2f}s, exceeding 60s limit"
90+
)
9191

9292
# For mock operations, should be very fast
9393
assert elapsed_time < 1.0, f"Mock operations took {elapsed_time:.3f}s, too slow"
@@ -162,12 +162,12 @@ def test_performance_requirements(self):
162162
elapsed_time = time.time() - start_time
163163

164164
# Should complete well within 60 seconds
165-
assert (
166-
elapsed_time < 60
167-
), f"Performance test took {elapsed_time:.2f}s, exceeding 60s limit"
168-
assert (
169-
elapsed_time < 1.0
170-
), f"Mock operations took {elapsed_time:.3f}s, expected faster"
165+
assert elapsed_time < 60, (
166+
f"Performance test took {elapsed_time:.2f}s, exceeding 60s limit"
167+
)
168+
assert elapsed_time < 1.0, (
169+
f"Mock operations took {elapsed_time:.3f}s, expected faster"
170+
)
171171

172172
@pytest.mark.asyncio
173173
async def test_async_performance_requirements(self):
@@ -184,12 +184,12 @@ async def test_async_performance_requirements(self):
184184
assert len(results) == 10
185185

186186
# Performance requirements
187-
assert (
188-
elapsed_time < 60
189-
), f"Async performance test took {elapsed_time:.2f}s, exceeding 60s limit"
190-
assert (
191-
elapsed_time < 1.0
192-
), f"Async mock operations took {elapsed_time:.3f}s, expected faster"
187+
assert elapsed_time < 60, (
188+
f"Async performance test took {elapsed_time:.2f}s, exceeding 60s limit"
189+
)
190+
assert elapsed_time < 1.0, (
191+
f"Async mock operations took {elapsed_time:.3f}s, expected faster"
192+
)
193193

194194

195195
class TestHttpxAsyncClient:
@@ -280,9 +280,9 @@ async def test_httpx_concurrent_requests(self):
280280
assert result["prompt"] == prompts[i]
281281

282282
# Performance check
283-
assert (
284-
elapsed_time < 60
285-
), f"HTTP requests took {elapsed_time:.2f}s, exceeding 60s limit"
283+
assert elapsed_time < 60, (
284+
f"HTTP requests took {elapsed_time:.2f}s, exceeding 60s limit"
285+
)
286286

287287
@pytest.mark.asyncio
288288
async def test_httpx_batch_requests(self):

tox.ini

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,67 +3,67 @@ envlist = py{39,310,311,312}, openllm-async-tests
33
skipsdist = True
44

55
[testenv]
6-
deps =
6+
deps =
77
-e .[testing]
8-
commands =
8+
commands =
99
pytest {posargs}
1010

1111
[testenv:openllm-async-tests]
12-
deps =
12+
deps =
1313
-e .[testing]
1414
pytest-asyncio>=0.21.1
1515
httpx
1616
pytest-cov>=4.1.0
17-
commands =
17+
commands =
1818
pytest tests/unit/test_openllm_run.py --cov=bentoml.openllm --cov-fail-under=90 --cov-report=term-missing -v --timeout=60
1919
setenv =
2020
PYTEST_TIMEOUT = 60
2121
passenv = *
2222
enable_parallel = true
2323

2424
[testenv:transformers-local]
25-
deps =
25+
deps =
2626
-e .[testing]
2727
pytest-asyncio>=0.21.1
2828
transformers
2929
torch
3030
tokenizers
3131
pytest-cov>=4.1.0
32-
commands =
32+
commands =
3333
pytest tests/integration/frameworks/test_transformers_async.py --cov=bentoml._internal.frameworks.transformers --cov-report=term-missing -v --timeout=300
3434

3535
[testenv:lint]
36-
deps =
36+
deps =
3737
ruff
3838
black
3939
mypy
40-
commands =
40+
commands =
4141
ruff check src/ tests/
4242
black --check src/ tests/
4343
mypy src/
4444

4545
[testenv:format]
46-
deps =
46+
deps =
4747
ruff
4848
black
49-
commands =
49+
commands =
5050
ruff check --fix src/ tests/
5151
black src/ tests/
5252

5353
[coverage:run]
5454
branch = True
5555
source = bentoml
56-
omit =
56+
omit =
5757
*/tests/*
5858
*/__pycache__/*
5959
*/site-packages/*
6060

6161
[coverage:report]
62-
exclude_lines =
62+
exclude_lines =
6363
pragma: no cover
6464
def __repr__
6565
raise AssertionError
6666
raise NotImplementedError
6767
if __name__ == .__main__.:
6868
if TYPE_CHECKING:
69-
precision = 2
69+
precision = 2

0 commit comments

Comments
 (0)