Skip to content

Commit 4fd51df

Browse files
fix: update test imports and fix linting issues
- Fix import paths from advanced_constraints to constraints package - Fix line length errors (E501) in test files - Fix type error for request_start None check - Update test coverage documentation Signed-off-by: Alon Kellner <[email protected]>
1 parent dba117c commit 4fd51df

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

src/guidellm/scheduler/constraints/over_saturation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ def __call__(
367367
request_info.status == "completed"
368368
and request_info.timings
369369
and request_info.timings.first_token_iteration
370+
and request_info.timings.request_start
370371
):
371372
ttft = (
372373
request_info.timings.first_token_iteration
@@ -446,7 +447,9 @@ def create_constraint(self, **_kwargs) -> Constraint:
446447
)
447448

448449
@classmethod
449-
def validated_kwargs(cls, stop_over_saturated: bool | None = None, **kwargs) -> dict[str, Any]:
450+
def validated_kwargs(
451+
cls, stop_over_saturated: bool | None = None, **kwargs
452+
) -> dict[str, Any]:
450453
"""
451454
Validate and process arguments for OverSaturationConstraint creation.
452455

tests/unit/scheduler/OVER_SATURATION_TEST_COVERAGE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ pytest tests/unit/scheduler/test_over_saturation*.py -m smoke -v
221221
pytest tests/unit/scheduler/test_over_saturation*.py -m sanity -v
222222

223223
# Run with coverage reporting
224-
pytest tests/unit/scheduler/test_over_saturation*.py --cov=guidellm.scheduler.advanced_constraints.over_saturation
224+
pytest tests/unit/scheduler/test_over_saturation*.py --cov=guidellm.scheduler.constraints.over_saturation
225225
```
226226

227227
## Conclusion

tests/unit/scheduler/test_over_saturation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def test_protocol_method_signature(self):
208208

209209
@pytest.mark.smoke
210210
def test_initialization_valid(self, valid_instances):
211-
"""Test that OverSaturationConstraint can be initialized with valid parameters."""
211+
"""Test OverSaturationConstraint initialization with valid parameters."""
212212
constraint, constructor_args = valid_instances
213213

214214
assert constraint.stop_over_saturated == constructor_args["stop_over_saturated"]
@@ -365,7 +365,7 @@ class TestOverSaturationConstraintInitializer:
365365
]
366366
)
367367
def valid_instances(self, request):
368-
"""Create OverSaturationConstraintInitializer instances with valid parameters."""
368+
"""Create OverSaturationConstraintInitializer with valid parameters."""
369369
constructor_args = request.param
370370
instance = OverSaturationConstraintInitializer(**constructor_args)
371371
return instance, constructor_args
@@ -553,7 +553,7 @@ class TestSlopeChecker:
553553
@pytest.fixture
554554
def slope_checker(self):
555555
"""Create a SlopeChecker instance for testing."""
556-
from guidellm.scheduler.advanced_constraints.over_saturation import (
556+
from guidellm.scheduler.constraints.over_saturation import (
557557
SlopeChecker,
558558
)
559559

tests/unit/scheduler/test_over_saturation_comprehensive.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
SchedulerState,
1818
SchedulerUpdateAction,
1919
)
20-
from guidellm.scheduler.advanced_constraints.over_saturation import (
20+
from guidellm.scheduler.constraints.over_saturation import (
2121
SlopeChecker,
2222
approx_t_ppf,
2323
)
@@ -411,7 +411,8 @@ def test_constraint_metadata_completeness(self):
411411
"ttft_slope",
412412
"ttft_n",
413413
"ttft_violations", # Correct field name
414-
# Note: total_started_ever, total_finished_ever, window sizes not in metadata
414+
# Note: total_started_ever, total_finished_ever,
415+
# window sizes not in metadata
415416
]
416417

417418
for field in required_fields:
@@ -840,5 +841,6 @@ def test_ttft_violation_counting_accuracy(self):
840841
detector.add_finished({"ttft": ttft, "duration": float(i)})
841842

842843
assert detector.ttft_violations_counter == expected_violations, (
843-
f"Expected {expected_violations} violations, got {detector.ttft_violations_counter}"
844+
f"Expected {expected_violations} violations, "
845+
f"got {detector.ttft_violations_counter}"
844846
)

0 commit comments

Comments
 (0)