openai: audio modality, remove sockets from unit tests (#27436)

This commit is contained in:
Erick Friis
2024-10-18 08:02:09 -07:00
committed by GitHub
parent 97dc578d47
commit 7d65a32ee0
10 changed files with 417 additions and 279 deletions

View File

@@ -8,7 +8,19 @@ TEST_FILE ?= tests/unit_tests/
integration_test integration_tests: TEST_FILE=tests/integration_tests/
test tests integration_test integration_tests:
# unit tests are run with the --disable-socket flag to prevent network calls
# use tiktoken cache to enable token counting without socket (internet) access
test tests:
mkdir -p tiktoken_cache
@if [ ! -f tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4 ]; then \
curl -o tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4 https://openaipublic.blob.core.windows.net/encodings/cl100k_base.tiktoken; \
fi
@if [ ! -f tiktoken_cache/fb374d419588a4632f3f557e76b4b70aebbca790 ]; then \
curl -o tiktoken_cache/fb374d419588a4632f3f557e76b4b70aebbca790 https://openaipublic.blob.core.windows.net/encodings/o200k_base.tiktoken; \
fi
TIKTOKEN_CACHE_DIR=tiktoken_cache poetry run pytest --disable-socket --allow-unix-socket $(TEST_FILE)
integration_test integration_tests:
poetry run pytest $(TEST_FILE)
test_watch: