diff --git a/libs/cli/langchain_cli/integration_template/Makefile b/libs/cli/langchain_cli/integration_template/Makefile index 2837e81a66a..ff29edb3d6e 100644 --- a/libs/cli/langchain_cli/integration_template/Makefile +++ b/libs/cli/langchain_cli/integration_template/Makefile @@ -7,7 +7,13 @@ all: help 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 +test tests: + poetry run pytest --disable-socket --allow-unit-socket $(TEST_FILE) + +# integration tests are run without the --disable-socket flag to allow network calls +integration_test integration_tests: poetry run pytest $(TEST_FILE) ###################### diff --git a/libs/cli/langchain_cli/integration_template/pyproject.toml b/libs/cli/langchain_cli/integration_template/pyproject.toml index 08a778b2fcd..8cb86a745d0 100644 --- a/libs/cli/langchain_cli/integration_template/pyproject.toml +++ b/libs/cli/langchain_cli/integration_template/pyproject.toml @@ -20,6 +20,7 @@ optional = true [tool.poetry.group.test.dependencies] pytest = "^7.4.3" pytest-asyncio = "^0.23.2" +pytest-socket = "^0.7.0" langchain-core = {path = "../../core", develop = true} [tool.poetry.group.codespell]