-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[test automation] support run tests on config file #730
Conversation
b672bb0
to
0b3637f
Compare
15efd09
to
bcdc0ed
Compare
e64eac2
to
3d9d714
Compare
74bf48e
to
cd62656
Compare
new_items, deselected_items = [], [] | ||
for item in items: | ||
if item.fspath in required_tests: | ||
func_name = item.name.split("[")[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like a somewhat fragile way to identify the function name. is there no other way?
- test_chat_completion_with_tool_calling | ||
- test_chat_completion_with_tool_calling_streaming | ||
|
||
inference_providers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be named inference_fixtures
so it is clearer?
cd62656
to
c352da8
Compare
def try_load_config_file_cached(config_file): | ||
if config_file is None: | ||
return None | ||
if CONFIG_CACHE is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need any caching? what was the reason you introduced it?
@@ -0,0 +1,76 @@ | |||
# Copyright (c) Meta Platforms, Inc. and affiliates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could put these functions all in the top-level conftest.py
?
- inference/test_text_inference.py::test_chat_completion_with_tool_calling_streaming | ||
|
||
fixtures: | ||
provider_fixtures: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a confusing thing -- why are there provider_fixtures
within fixtures
? also it is unclear why we have a "default_fixture_param_id" and what it indicates. Can you explain a bit?
292b201
to
33de00c
Compare
33de00c
to
901c10d
Compare
81501ae
to
d19526e
Compare
7d40e88
to
cd1a155
Compare
|
||
|
||
class TestConfig(BaseModel): | ||
inference: APITestConfig = Field(default=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of these should be Optional
and should look like
: Optional[...Config] = None
|
||
|
||
def get_provider_fixture_overrides_from_test_config( | ||
config, api, default_provider_fixture_combination |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this could be named metafunc_config
so it is clearer what it is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another nit: the last parameter should be a plural (combinations)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, thanks for the iteration. a couple minor nits.
Context
For test automation, the end goal is to run a single pytest command from root test directory (llama_stack/providers/tests/.) such that we execute push-blocking tests
The work plan:
What does this PR do?
consolidates the "inference-models" / "embedding-model" / "judge-model" ... options in root conftest.py. Without this change, we will hit into error when trying to run
pytest /Users/sxyi/llama-stack/llama_stack/providers/tests/.
because of duplicatedaddoptions
definitions across child conftest files.Add a
config
option to specify test config in YAML. (seeci_test_config.yaml
for example config file)For provider_fixtures, we allow users to use either a default fixture combination or define their own {api:provider} combinations.
a) in
{api}/conftest.py::pytest_generate_tests
, we read from config to do parametrization.b) after test collection, in
pytest_collection_modifyitems
, we filter the tests to include only functions listed in config.Test Plan
pytest /Users/sxyi/llama-stack/llama_stack/providers/tests/. --collect-only --config=ci_test_config.yaml
Using
--collect-only
tag to print the pytests listed in the config file (ci_test_config.yaml
).output: gist
--inference-model
optionBefore submitting
Pull Request section?