-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow deleting a Pagefind index in a context, update docs to match
- Loading branch information
Showing
3 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
pagefind/integration_tests/python_api/py-close-the-pagefind-backend.toolproof.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Python API > Close the Pagefind backend | ||
platforms: | ||
- linux | ||
- mac | ||
|
||
steps: | ||
- ref: ./background.toolproof.yml | ||
- step: I have a "public/run.py" file with the content {python} | ||
python: |2- | ||
import sys | ||
sys.path.append('%repo_wd%/wrappers/python/src') | ||
import asyncio | ||
import json | ||
import logging | ||
import os | ||
from pagefind.index import PagefindIndex, IndexConfig | ||
async def main(): | ||
async with PagefindIndex() as index: | ||
files = await index.get_files() | ||
for file in files: | ||
print(file["path"]) | ||
await index.delete_index() | ||
try: | ||
files = await index.get_files() | ||
except AssertionError: | ||
print("errored getting files after close") | ||
if __name__ == "__main__": | ||
asyncio.run(main()) | ||
- step: I run "cd public && PAGEFIND_BINARY_PATH=%pagefind_exec_path% python3 run.py" | ||
- step: stdout should contain "pagefind.js" | ||
- step: stdout should contain "pagefind-ui.js" | ||
- step: stdout should contain "errored getting files after close" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters