Skip to content
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

Extend process_notebooks for testing #1789

Merged
merged 10 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
quarto render .
- name: Process notebooks
run: |
python process_notebooks.py
python process_notebooks.py render
- name: Test Build
run: |
if [ -e yarn.lock ]; then
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
quarto render .
- name: Process notebooks
run: |
python process_notebooks.py
python process_notebooks.py render
- name: Build website
run: |
if [ -e yarn.lock ]; then
Expand Down
3 changes: 2 additions & 1 deletion notebook/agentchat_RetrieveChat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3036,7 +3036,8 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"test_skip": "Requires interactive usage"
},
"nbformat": 4,
"nbformat_minor": 4
Expand Down
32 changes: 32 additions & 0 deletions notebook/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,35 @@ Learn more about configuring LLMs for agents [here](/docs/llm_configuration).
:::
````
``````

## Testing

Notebooks can be tested by running:

```sh
python website/process_notebooks.py test
```

This will automatically scan for all notebooks in the notebook/ and website/ dirs.

To test a specific notebook pass its path:

```sh
python website/process_notebooks.py test notebook/agentchat_logging.ipynb
```

Options:
- `--timeout` - timeout for a single notebook
- `--exit-on-first-fail` - stop executing further notebooks after the first one fails

### Skip tests

If a notebook needs to be skipped then add to the notebook metadata:
jackgerrits marked this conversation as resolved.
Show resolved Hide resolved
```json
{
"...": "...",
"metadata": {
"test_skip": "REASON"
}
}
```
3 changes: 1 addition & 2 deletions website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ Navigate to the `website` folder and run:

```console
pydoc-markdown
quarto render ./docs
python ./process_notebooks.py
python ./process_notebooks.py render
yarn start
```

Expand Down
5 changes: 1 addition & 4 deletions website/build_website.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ fi
# Generate documentation using pydoc-markdown
pydoc-markdown

# Render the website using Quarto
quarto render ./docs

# Process notebooks using a Python script
python ./process_notebooks.py
python ./process_notebooks.py render
jackgerrits marked this conversation as resolved.
Show resolved Hide resolved

# Start the website using yarn
yarn start
8 changes: 5 additions & 3 deletions website/docs/Contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ Tests for the `autogen.agentchat.contrib` module may be skipped automatically if
required dependencies are not installed. Please consult the documentation for
each contrib module to see what dependencies are required.

See [here](https://github.com/microsoft/autogen/blob/main/notebook/contributing.md#testing) for how to run notebook tests.

#### Skip flags for tests

- `--skip-openai` for skipping tests that require access to OpenAI services.
Expand Down Expand Up @@ -216,11 +218,11 @@ Then:

```console
npm install --global yarn # skip if you use the dev container we provided
pip install pydoc-markdown # skip if you use the dev container we provided
pip install pydoc-markdown pyyaml termcolor # skip if you use the dev container we provided
cd website
yarn install --frozen-lockfile --ignore-engines
pydoc-markdown
quarto render ./docs
python process_notebooks.py render
yarn start
```

Expand All @@ -245,7 +247,7 @@ Once at the CLI in Docker run the following commands:
cd website
yarn install --frozen-lockfile --ignore-engines
pydoc-markdown
quarto render ./docs
python process_notebooks.py render
yarn start --host 0.0.0.0 --port 3000
```

Expand Down
Loading
Loading