Files
kserve/test/e2e/llmisvc/conftest.py
2026-03-06 08:39:33 +00:00

47 lines
1.6 KiB
Python

# Copyright 2025 The KServe Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Fixture factory - not called explicitly, but must be imported for pytest to discover it.
from .fixtures import test_case # noqa: F401
# This hook is used to ensure that the test names are unique and to ensure that
# the test names are consistent with the cluster marks.
def pytest_collection_modifyitems(config, items):
for item in items:
# only touch parameterized tests
if not hasattr(item, "callspec"):
continue
# if there's no [...] suffix (i.e. not parametrized), skip
if "[" not in item.nodeid:
continue
base, rest = item.nodeid.split("[", 1)
rest = rest.rstrip("]")
cluster_marks = [
m.name for m in item.iter_markers() if m.name.startswith("cluster_")
]
if not cluster_marks:
continue
new_id = "-".join(cluster_marks + [rest])
item._nodeid = f"{base}[{new_id}]"
def pytest_configure(config):
config.addinivalue_line(
"markers", "llminferenceservice: mark test as an LLM inference service test"
)