Skip to content

Commit 601662a

Browse files
[Docs/Contributing] Clarification on running non-OpenAI tests (microsoft#1052)
* Update Contribute.md * Removed mentioning of OAI_CONFIG_LIST --------- Co-authored-by: Qingyun Wu <[email protected]>
1 parent 7ea4c6c commit 601662a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

website/docs/Contribute.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,22 @@ Tests are automatically run via GitHub actions. There are two workflows:
120120
1. [build.yml](https://github.com/microsoft/autogen/blob/main/.github/workflows/build.yml)
121121
1. [openai.yml](https://github.com/microsoft/autogen/blob/main/.github/workflows/openai.yml)
122122

123-
The first workflow is required to pass for all PRs. The second workflow is required for changes that affect the openai tests. The second workflow requires approval to run. When writing tests that require openai, please use [`pytest.mark.skipif`](https://github.com/microsoft/autogen/blob/main/test/test_client.py#L13) to make them run in one python version only when openai is installed. If additional dependency for this test is required, install the dependency in the corresponding python version in [openai.yml](https://github.com/microsoft/autogen/blob/main/.github/workflows/openai.yml).
123+
The first workflow is required to pass for all PRs (and it doesn't do any OpenAI calls). The second workflow is required for changes that affect the OpenAI tests (and does actually call LLM). The second workflow requires approval to run. When writing tests that require OpenAI calls, please use [`pytest.mark.skipif`](https://github.com/microsoft/autogen/blob/b1adac515931bf236ac59224269eeec683a162ba/test/oai/test_client.py#L19) to make them run in one python version only when `openai` package is installed. If additional dependency for this test is required, install the dependency in the corresponding python version in [openai.yml](https://github.com/microsoft/autogen/blob/main/.github/workflows/openai.yml).
124+
125+
#### Run non-OpenAI tests
126+
127+
To run the subset of the tests not depending on `openai` (and not calling LLMs)):
128+
- Install `pytest`
129+
- Remove `openai` library, this is required to skip the tests which check for `openai` presence ([`pytest.mark.skipif`](https://github.com/microsoft/autogen/blob/b1adac515931bf236ac59224269eeec683a162ba/test/oai/test_client.py#L19))
130+
- Run the tests from the `test` folder. Make sure they all pass, this is required for [build.yml](https://github.com/microsoft/autogen/blob/main/.github/workflows/build.yml) checks to pass
131+
- Reinstall `openai`
132+
133+
```
134+
pip install pytest
135+
pip uninstall -y openai
136+
pytest test
137+
pip install openai
138+
```
124139

125140
### Coverage
126141

0 commit comments

Comments
 (0)