multiple: disable socket for unit tests (#29080)

This commit is contained in:
Erick Friis 2025-01-07 15:31:50 -08:00 committed by GitHub
parent 539ebd5431
commit fcc9cdd100
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 123 additions and 19 deletions

View File

@ -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:

View File

@ -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"

View File

@ -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"

View File

@ -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:

View File

@ -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"

View File

@ -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"

View File

@ -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:

View File

@ -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"

View File

@ -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"

View File

@ -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:

View File

@ -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"

View File

@ -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"

View File

@ -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:

View File

@ -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"

View File

@ -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"

View File

@ -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:

View File

@ -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"

View File

@ -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

View File

@ -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:

View File

@ -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"

View File

@ -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"

View File

@ -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)
######################

View File

@ -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"

View File

@ -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 }