From fcc9cdd1007780e307beb6a9a94688d28d985098 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Tue, 7 Jan 2025 15:31:50 -0800 Subject: [PATCH] multiple: disable socket for unit tests (#29080) --- libs/partners/anthropic/Makefile | 5 ++++- libs/partners/anthropic/poetry.lock | 2 +- libs/partners/anthropic/pyproject.toml | 1 + libs/partners/chroma/Makefile | 5 ++++- libs/partners/chroma/poetry.lock | 16 +++++++++++++++- libs/partners/chroma/pyproject.toml | 16 ++++++++++++++-- libs/partners/fireworks/Makefile | 5 ++++- libs/partners/fireworks/poetry.lock | 2 +- libs/partners/fireworks/pyproject.toml | 1 + libs/partners/huggingface/Makefile | 5 ++++- libs/partners/huggingface/poetry.lock | 16 +++++++++++++++- libs/partners/huggingface/pyproject.toml | 1 + libs/partners/pinecone/Makefile | 5 ++++- libs/partners/pinecone/poetry.lock | 2 +- libs/partners/pinecone/pyproject.toml | 1 + libs/partners/qdrant/Makefile | 5 ++++- libs/partners/qdrant/poetry.lock | 18 ++++++++++++++++-- libs/partners/qdrant/pyproject.toml | 1 + libs/partners/voyageai/Makefile | 5 ++++- libs/partners/voyageai/poetry.lock | 16 +++++++++++++++- libs/partners/voyageai/pyproject.toml | 1 + libs/partners/xai/Makefile | 5 ++++- libs/partners/xai/poetry.lock | 2 +- libs/partners/xai/pyproject.toml | 6 ++++++ 24 files changed, 123 insertions(+), 19 deletions(-) diff --git a/libs/partners/anthropic/Makefile b/libs/partners/anthropic/Makefile index 0bab6dfe077fd..cdb61e6081453 100644 --- a/libs/partners/anthropic/Makefile +++ b/libs/partners/anthropic/Makefile @@ -7,7 +7,10 @@ all: help TEST_FILE ?= tests/unit_tests/ integration_test integration_tests: TEST_FILE=tests/integration_tests/ -test tests integration_test integration_tests: +test tests: + poetry run pytest -vvv --timeout 30 --disable-socket --allow-unix-socket $(TEST_FILE) + +integration_test integration_tests: poetry run pytest -vvv --timeout 30 $(TEST_FILE) test_watch: diff --git a/libs/partners/anthropic/poetry.lock b/libs/partners/anthropic/poetry.lock index 3186e11cc9e42..2729e80cf9c2f 100644 --- a/libs/partners/anthropic/poetry.lock +++ b/libs/partners/anthropic/poetry.lock @@ -1343,4 +1343,4 @@ watchmedo = ["PyYAML (>=3.10)"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "7d087b04b53259355c5e0ebef8b777f0534849bcead105a0de3eb284461019c3" +content-hash = "c22d86d391e97dc8befa33fbd7ca674410eb318e2bef08e28284449b2a57aedf" diff --git a/libs/partners/anthropic/pyproject.toml b/libs/partners/anthropic/pyproject.toml index adf12952fb639..8224f59585a67 100644 --- a/libs/partners/anthropic/pyproject.toml +++ b/libs/partners/anthropic/pyproject.toml @@ -66,6 +66,7 @@ pytest-watcher = "^0.3.4" pytest-asyncio = "^0.21.1" defusedxml = "^0.7.1" pytest-timeout = "^2.3.1" +pytest-socket = "^0.7.0" [tool.poetry.group.codespell.dependencies] codespell = "^2.2.0" diff --git a/libs/partners/chroma/Makefile b/libs/partners/chroma/Makefile index 3f635f57498c3..7818baa86158d 100644 --- a/libs/partners/chroma/Makefile +++ b/libs/partners/chroma/Makefile @@ -7,7 +7,10 @@ all: help TEST_FILE ?= tests/unit_tests/ integration_test integration_tests: TEST_FILE = tests/integration_tests/ -test tests integration_test integration_tests: +test tests: + poetry run pytest --disable-socket --allow-unix-socket $(TEST_FILE) + +integration_test integration_tests: poetry run pytest $(TEST_FILE) test_watch: diff --git a/libs/partners/chroma/poetry.lock b/libs/partners/chroma/poetry.lock index f4b4192f448a0..11ea60f0e50b0 100644 --- a/libs/partners/chroma/poetry.lock +++ b/libs/partners/chroma/poetry.lock @@ -1941,6 +1941,20 @@ pytest = ">=6.2.5" [package.extras] dev = ["pre-commit", "pytest-asyncio", "tox"] +[[package]] +name = "pytest-socket" +version = "0.7.0" +description = "Pytest Plugin to disable socket calls during tests" +optional = false +python-versions = ">=3.8,<4.0" +files = [ + {file = "pytest_socket-0.7.0-py3-none-any.whl", hash = "sha256:7e0f4642177d55d317bbd58fc68c6bd9048d6eadb2d46a89307fa9221336ce45"}, + {file = "pytest_socket-0.7.0.tar.gz", hash = "sha256:71ab048cbbcb085c15a4423b73b619a8b35d6a307f46f78ea46be51b1b7e11b3"}, +] + +[package.dependencies] +pytest = ">=6.2.5" + [[package]] name = "pytest-watcher" version = "0.3.5" @@ -2824,4 +2838,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4" -content-hash = "2d6bc4b9a18a322c326c3f7d5786c4b196a997458e6d2ca4043cb6b7a4a123b3" +content-hash = "24ab2f4c5777fdd73a46207600a2ec66b401acae4fb1e3be28a3a4097160ca03" diff --git a/libs/partners/chroma/pyproject.toml b/libs/partners/chroma/pyproject.toml index 8a7e18bdf1bf3..156de25d4e275 100644 --- a/libs/partners/chroma/pyproject.toml +++ b/libs/partners/chroma/pyproject.toml @@ -80,7 +80,11 @@ syrupy = "^4.0.2" pytest-watcher = "^0.3.4" pytest-asyncio = "^0.21.1" # hack to make sure py3.9 compatible versionof onnxruntime is installed for testing -onnxruntime = [{version = "<1.20", python = "<3.10"}, {version = "*", python = ">=3.10"}] +onnxruntime = [ + { version = "<1.20", python = "<3.10" }, + { version = "*", python = ">=3.10" }, +] +pytest-socket = "^0.7.0" [[tool.poetry.group.test.dependencies.langchain-core]] path = "../../core" develop = true @@ -94,15 +98,22 @@ python = "<3.9" path = "../../standard-tests" develop = true + [tool.poetry.group.codespell.dependencies] codespell = "^2.2.0" + [tool.poetry.group.test_integration.dependencies] + [tool.poetry.group.lint.dependencies] ruff = "^0.5" # hack to make sure py3.9 compatible versionof onnxruntime is installed for testing -onnxruntime = [{version = "<1.20", python = "<3.10"}, {version = "*", python = ">=3.10"}] +onnxruntime = [ + { version = "<1.20", python = "<3.10" }, + { version = "*", python = ">=3.10" }, +] + [tool.poetry.group.dev.dependencies] [[tool.poetry.group.dev.dependencies.langchain-core]] @@ -114,6 +125,7 @@ python = ">=3.9" version = ">=0.1.40,<0.3" python = "<3.9" + [tool.poetry.group.typing.dependencies] mypy = "^1.10" types-requests = "^2.31.0.20240406" diff --git a/libs/partners/fireworks/Makefile b/libs/partners/fireworks/Makefile index 4b2ef400f1c11..e1c8e80ac0b32 100644 --- a/libs/partners/fireworks/Makefile +++ b/libs/partners/fireworks/Makefile @@ -7,7 +7,10 @@ all: help TEST_FILE ?= tests/unit_tests/ integration_test integration_tests: TEST_FILE = tests/integration_tests/ -test tests integration_test integration_tests: +test tests: + poetry run pytest --disable-socket --allow-unix-socket $(TEST_FILE) + +integration_test integration_tests: poetry run pytest $(TEST_FILE) test_watch: diff --git a/libs/partners/fireworks/poetry.lock b/libs/partners/fireworks/poetry.lock index 10c837ed56011..367a83b2b046e 100644 --- a/libs/partners/fireworks/poetry.lock +++ b/libs/partners/fireworks/poetry.lock @@ -2054,4 +2054,4 @@ propcache = ">=0.2.0" [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "6ad4d438ed6657e39e016ae7b54a69f229d36aa33d32f3397d0098fa7fae7449" +content-hash = "45e6234a03b287c77a8d16017ccc56237315693f46a2f4f6b0a07a6f7c7ecc87" diff --git a/libs/partners/fireworks/pyproject.toml b/libs/partners/fireworks/pyproject.toml index c187500417c81..6c6bf26430a70 100644 --- a/libs/partners/fireworks/pyproject.toml +++ b/libs/partners/fireworks/pyproject.toml @@ -62,6 +62,7 @@ pytest-mock = "^3.10.0" syrupy = "^4.0.2" pytest-watcher = "^0.3.4" pytest-asyncio = "^0.21.1" +pytest-socket = "^0.7.0" [tool.poetry.group.codespell.dependencies] codespell = "^2.2.0" diff --git a/libs/partners/huggingface/Makefile b/libs/partners/huggingface/Makefile index 62ab3e92260b4..bb5a8018b95d5 100644 --- a/libs/partners/huggingface/Makefile +++ b/libs/partners/huggingface/Makefile @@ -8,7 +8,10 @@ TEST_FILE ?= tests/unit_tests/ integration_test integration_tests: TEST_FILE=tests/integration_tests/ -test tests integration_test integration_tests: +test tests: + poetry run pytest --disable-socket --allow-unix-socket $(TEST_FILE) + +integration_test integration_tests: poetry run pytest $(TEST_FILE) test_watch: diff --git a/libs/partners/huggingface/poetry.lock b/libs/partners/huggingface/poetry.lock index 245d3723c28ca..755eb2003a02c 100644 --- a/libs/partners/huggingface/poetry.lock +++ b/libs/partners/huggingface/poetry.lock @@ -2411,6 +2411,20 @@ pytest = ">=7.0.0" docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1.0)"] testing = ["coverage (>=6.2)", "flaky (>=3.5.0)", "hypothesis (>=5.7.1)", "mypy (>=0.931)", "pytest-trio (>=0.7.0)"] +[[package]] +name = "pytest-socket" +version = "0.7.0" +description = "Pytest Plugin to disable socket calls during tests" +optional = false +python-versions = ">=3.8,<4.0" +files = [ + {file = "pytest_socket-0.7.0-py3-none-any.whl", hash = "sha256:7e0f4642177d55d317bbd58fc68c6bd9048d6eadb2d46a89307fa9221336ce45"}, + {file = "pytest_socket-0.7.0.tar.gz", hash = "sha256:71ab048cbbcb085c15a4423b73b619a8b35d6a307f46f78ea46be51b1b7e11b3"}, +] + +[package.dependencies] +pytest = ">=6.2.5" + [[package]] name = "pytest-watcher" version = "0.3.5" @@ -3875,4 +3889,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "2d468da765374084b6ad008d1b3e6d4d12f3c1d696cea84f2245f49012691272" +content-hash = "8ca5060b227b1c9ab5f16ea660bb5868a79e9233f93a850b6ffddc5ac7b5e81c" diff --git a/libs/partners/huggingface/pyproject.toml b/libs/partners/huggingface/pyproject.toml index c725ed90afe79..493c8907413e7 100644 --- a/libs/partners/huggingface/pyproject.toml +++ b/libs/partners/huggingface/pyproject.toml @@ -59,6 +59,7 @@ optional = true pytest = "^7.3.0" pytest-asyncio = "^0.21.1" pytest-watcher = "^0.3.4" +pytest-socket = "^0.7.0" [[tool.poetry.group.test.dependencies.scipy]] version = "^1" diff --git a/libs/partners/pinecone/Makefile b/libs/partners/pinecone/Makefile index d2f1c9265f7bd..048ea097895fc 100644 --- a/libs/partners/pinecone/Makefile +++ b/libs/partners/pinecone/Makefile @@ -7,7 +7,10 @@ all: help TEST_FILE ?= tests/unit_tests/ integration_test integration_tests: TEST_FILE = tests/integration_tests/ -test tests integration_test integration_tests: +test tests: + poetry run pytest --disable-socket --allow-unix-socket $(TEST_FILE) + +integration_test integration_tests: poetry run pytest $(TEST_FILE) test_watch: diff --git a/libs/partners/pinecone/poetry.lock b/libs/partners/pinecone/poetry.lock index 91e3837016a31..7bc0bc1d060bf 100644 --- a/libs/partners/pinecone/poetry.lock +++ b/libs/partners/pinecone/poetry.lock @@ -2127,4 +2127,4 @@ propcache = ">=0.2.0" [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.13" -content-hash = "45edeae182a36978fe4c7a68bddbda9b57727141433f457cbf73c9485fcc8749" +content-hash = "c6bfaf9d0fdb71fc6aa80ee07d08a558c6ae414481e47f1feb56edcbd0d16bb1" diff --git a/libs/partners/pinecone/pyproject.toml b/libs/partners/pinecone/pyproject.toml index 57bbaae26da30..53c80ac9f00bc 100644 --- a/libs/partners/pinecone/pyproject.toml +++ b/libs/partners/pinecone/pyproject.toml @@ -63,6 +63,7 @@ pytest-mock = "^3.10.0" syrupy = "^4.0.2" pytest-watcher = "^0.3.4" pytest-asyncio = ">=0.25.0,<1" +pytest-socket = "^0.7.0" [tool.poetry.group.codespell.dependencies] codespell = "^2.2.0" diff --git a/libs/partners/qdrant/Makefile b/libs/partners/qdrant/Makefile index ffab929526bd5..5dfd343da44ad 100644 --- a/libs/partners/qdrant/Makefile +++ b/libs/partners/qdrant/Makefile @@ -8,7 +8,10 @@ TEST_FILE ?= tests/unit_tests/ integration_test integration_tests: TEST_FILE = tests/integration_tests/ -test tests integration_test integration_tests: +test tests: + poetry run pytest --disable-socket --allow-unix-socket $(TEST_FILE) + +integration_test integration_tests: poetry run pytest $(TEST_FILE) test_watch: diff --git a/libs/partners/qdrant/poetry.lock b/libs/partners/qdrant/poetry.lock index 41fd237e2b117..2a2935582cdd5 100644 --- a/libs/partners/qdrant/poetry.lock +++ b/libs/partners/qdrant/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "annotated-types" @@ -1556,6 +1556,20 @@ pytest = ">=6.2.5" [package.extras] dev = ["pre-commit", "pytest-asyncio", "tox"] +[[package]] +name = "pytest-socket" +version = "0.7.0" +description = "Pytest Plugin to disable socket calls during tests" +optional = false +python-versions = ">=3.8,<4.0" +files = [ + {file = "pytest_socket-0.7.0-py3-none-any.whl", hash = "sha256:7e0f4642177d55d317bbd58fc68c6bd9048d6eadb2d46a89307fa9221336ce45"}, + {file = "pytest_socket-0.7.0.tar.gz", hash = "sha256:71ab048cbbcb085c15a4423b73b619a8b35d6a307f46f78ea46be51b1b7e11b3"}, +] + +[package.dependencies] +pytest = ">=6.2.5" + [[package]] name = "pytest-watcher" version = "0.3.5" @@ -2141,4 +2155,4 @@ fastembed = ["fastembed"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4" -content-hash = "2a325d2b9028b0f32aa3cc7a15c22fe32568452e8c91cfc5b68642faed09a013" +content-hash = "d3da6307476f136c84041e9256868c1e571bffb612216d0e962734c6005407a1" diff --git a/libs/partners/qdrant/pyproject.toml b/libs/partners/qdrant/pyproject.toml index 13e9dc8236bd0..20f950c1e09d3 100644 --- a/libs/partners/qdrant/pyproject.toml +++ b/libs/partners/qdrant/pyproject.toml @@ -66,6 +66,7 @@ syrupy = "^4.0.2" pytest-watcher = "^0.3.4" pytest-asyncio = "^0.21.1" requests = "^2.31.0" +pytest-socket = "^0.7.0" [[tool.poetry.group.test.dependencies.langchain-core]] path = "../../core" develop = true diff --git a/libs/partners/voyageai/Makefile b/libs/partners/voyageai/Makefile index 0d2d194ce0449..4c8bb2bc0fe91 100644 --- a/libs/partners/voyageai/Makefile +++ b/libs/partners/voyageai/Makefile @@ -7,7 +7,10 @@ all: help TEST_FILE ?= tests/unit_tests/ integration_test integration_tests: TEST_FILE=tests/integration_tests/ -test tests integration_test integration_tests: +test tests: + poetry run pytest --disable-socket --allow-unix-socket $(TEST_FILE) + +integration_test integration_tests: poetry run pytest $(TEST_FILE) test_watch: diff --git a/libs/partners/voyageai/poetry.lock b/libs/partners/voyageai/poetry.lock index 73483f66fd34c..d3fb3cee78097 100644 --- a/libs/partners/voyageai/poetry.lock +++ b/libs/partners/voyageai/poetry.lock @@ -1418,6 +1418,20 @@ pytest = ">=6.2.5" [package.extras] dev = ["pre-commit", "pytest-asyncio", "tox"] +[[package]] +name = "pytest-socket" +version = "0.7.0" +description = "Pytest Plugin to disable socket calls during tests" +optional = false +python-versions = ">=3.8,<4.0" +files = [ + {file = "pytest_socket-0.7.0-py3-none-any.whl", hash = "sha256:7e0f4642177d55d317bbd58fc68c6bd9048d6eadb2d46a89307fa9221336ce45"}, + {file = "pytest_socket-0.7.0.tar.gz", hash = "sha256:71ab048cbbcb085c15a4423b73b619a8b35d6a307f46f78ea46be51b1b7e11b3"}, +] + +[package.dependencies] +pytest = ">=6.2.5" + [[package]] name = "pytest-watcher" version = "0.3.5" @@ -1905,4 +1919,4 @@ propcache = ">=0.2.0" [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.13" -content-hash = "e1582b69124ba27255c851d955e40ebc8c7483543240843d276a933f10fe71c7" +content-hash = "c124f82eb6590af74422548d8261e425486f206e818e5848a5c43b523e601c30" diff --git a/libs/partners/voyageai/pyproject.toml b/libs/partners/voyageai/pyproject.toml index d59324931ec7a..a891839f90ce0 100644 --- a/libs/partners/voyageai/pyproject.toml +++ b/libs/partners/voyageai/pyproject.toml @@ -57,6 +57,7 @@ pytest-mock = "^3.10.0" syrupy = "^4.0.2" pytest-watcher = "^0.3.4" pytest-asyncio = "^0.21.1" +pytest-socket = "^0.7.0" [[tool.poetry.group.test.dependencies.numpy]] version = "^1.24.0" python = "<3.12" diff --git a/libs/partners/xai/Makefile b/libs/partners/xai/Makefile index 1626a01bc493c..963563e2d7099 100644 --- a/libs/partners/xai/Makefile +++ b/libs/partners/xai/Makefile @@ -8,7 +8,10 @@ TEST_FILE ?= tests/unit_tests/ integration_test integration_tests: TEST_FILE=tests/integration_tests/ -test tests integration_test integration_tests: +test tests: + poetry run pytest --disable-socket --allow-unix-socket $(TEST_FILE) + +integration_test integration_tests: poetry run pytest $(TEST_FILE) ###################### diff --git a/libs/partners/xai/poetry.lock b/libs/partners/xai/poetry.lock index 294cdfa338637..7b605b8b14bf4 100644 --- a/libs/partners/xai/poetry.lock +++ b/libs/partners/xai/poetry.lock @@ -2122,4 +2122,4 @@ propcache = ">=0.2.0" [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "5f922370eb32d79a26e769e13b0cee1f09d6caa7fb4f61f43e77ee0eb0d61dad" +content-hash = "ab1d2f38bf7404b05ad63b5ebfabd149d65760bbc0ee96c2d2f539912ac8f8ad" diff --git a/libs/partners/xai/pyproject.toml b/libs/partners/xai/pyproject.toml index a6872c3913bb3..7b3f776cb0a30 100644 --- a/libs/partners/xai/pyproject.toml +++ b/libs/partners/xai/pyproject.toml @@ -75,12 +75,15 @@ docarray = "^0.32.1" langchain-openai = { path = "../openai", develop = true } langchain-core = { path = "../../core", develop = true } langchain-tests = { path = "../../standard-tests", develop = true } +pytest-socket = "^0.7.0" + [tool.poetry.group.codespell.dependencies] codespell = "^2.2.0" + [tool.poetry.group.test_integration.dependencies] [[tool.poetry.group.test_integration.dependencies.numpy]] version = "^1" @@ -91,15 +94,18 @@ version = "^1.26.0" python = ">=3.12" + [tool.poetry.group.lint.dependencies] ruff = "^0.5" + [tool.poetry.group.typing.dependencies] mypy = "^1.10" types-requests = "^2" langchain-core = { path = "../../core", develop = true } + [tool.poetry.group.dev.dependencies] langchain-core = { path = "../../core", develop = true }