Skip to content

Commit d45f8d0

Browse files
authored
chore(ci): fix skipping test if chat completion not available [backport #7838 to 2.3] (#7842)
Backports #7838 to 2.3 #7759 introduced a regression test for testing openai's ChatCompletion endpoint, but omitted a conditional test skip if the version of openai being tested does not support ChatCompletions (`<=0.26.5`). For some reason this was not being reported in regular CI runs but was being caught on CI runs on the main branch. ## Checklist - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed. If no release note is required, add label `changelog/no-changelog`. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment. - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) - [x] If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from `@DataDog/security-design-and-guidance`. - [x] This PR doesn't touch any of that.
1 parent 8f10c0b commit d45f8d0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/contrib/openai/test_openai_v0.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,8 @@ def test_chat_completion_tool_calling(openai, openai_vcr, snapshot_tracer):
526526
],
527527
)
528528
def test_chat_completion_image_input(openai, openai_vcr, snapshot_tracer):
529+
if not hasattr(openai, "ChatCompletion"):
530+
pytest.skip("ChatCompletion not supported for this version of openai")
529531
image_url = (
530532
"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk"
531533
".jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"

0 commit comments

Comments
 (0)