Skip to content

Commit

Permalink
Python: Run notebooks as tests (microsoft#6430)
Browse files Browse the repository at this point in the history
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
Run notebooks as tests, working for all gettings started notebooks.
Also updated learn resources samples test, this can now easily be
extended with other sample scripts.

Closes: microsoft#4637
Partially closes: microsoft#4638

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
  • Loading branch information
eavanvalkenburg authored May 29, 2024
1 parent 02145d9 commit e03b3fa
Show file tree
Hide file tree
Showing 7 changed files with 348 additions and 137 deletions.
211 changes: 208 additions & 3 deletions python/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pyarrow = { version = ">=12.0.1,<16.0.0", optional = true}
pre-commit = ">=3.7.1"
ruff = ">=0.4.5"
ipykernel = "^6.29.4"
nbconvert = "^7.16.4"
pytest = "^8.2.1"
pytest-asyncio = "^0.23.7"
snoop = "^0.4.3"
Expand Down
5 changes: 4 additions & 1 deletion python/samples/getting_started/00-getting-started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@
"\n",
"joke_function = plugin[\"Joke\"]\n",
"\n",
"joke = await kernel.invoke(joke_function, KernelArguments(input=\"time travel to dinosaur age\", style=\"super silly\"))\n",
"joke = await kernel.invoke(\n",
" joke_function,\n",
" KernelArguments(input=\"time travel to dinosaur age\", style=\"super silly\"),\n",
")\n",
"print(joke)"
]
}
Expand Down
Loading

0 comments on commit e03b3fa

Please sign in to comment.