Skip to content

Commit 1c797ac

Browse files
baskaryanErick Friis
and
Erick Friis
authored
infra: speed up unit tests (#28974)
Co-authored-by: Erick Friis <erick@langchain.dev>
1 parent 79fc9b6 commit 1c797ac

File tree

15 files changed

+281
-57
lines changed

15 files changed

+281
-57
lines changed

.github/workflows/_test.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ jobs:
5959
env:
6060
MIN_VERSIONS: ${{ steps.min-version.outputs.min-versions }}
6161
run: |
62-
poetry run pip install $MIN_VERSIONS
62+
poetry run pip install uv
63+
poetry run uv pip install $MIN_VERSIONS
6364
make tests
6465
working-directory: ${{ inputs.working-directory }}
6566

libs/community/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ coverage:
1616
$(TEST_FILE)
1717

1818
test tests:
19-
poetry run pytest --disable-socket --allow-unix-socket $(TEST_FILE)
19+
poetry run pytest -n auto --disable-socket --allow-unix-socket $(TEST_FILE)
2020

2121
integration_tests:
2222
poetry run pytest $(TEST_FILE)

libs/community/poetry.lock

+83-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/community/pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ pytest-mock = "^3.10.0"
102102
pytest-socket = "^0.6.0"
103103
syrupy = "^4.0.2"
104104
requests-mock = "^1.11.0"
105+
pytest-xdist = "^3.6.1"
105106
[[tool.poetry.group.test.dependencies.cffi]]
106107
version = "<1.17.1"
107108
python = "<3.10"

libs/community/tests/unit_tests/test_dependencies.py

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def test_test_group_dependencies(poetry_conf: Mapping[str, Any]) -> None:
9191
"pytest-mock",
9292
"pytest-socket",
9393
"pytest-watcher",
94+
"pytest-xdist",
9495
"responses",
9596
"syrupy",
9697
"requests-mock",

libs/core/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test tests:
1212
-u LANGCHAIN_API_KEY \
1313
-u LANGSMITH_TRACING \
1414
-u LANGCHAIN_PROJECT \
15-
poetry run pytest --disable-socket --allow-unix-socket $(TEST_FILE)
15+
poetry run pytest -n auto --disable-socket --allow-unix-socket $(TEST_FILE)
1616

1717
test_watch:
1818
env \

libs/core/poetry.lock

+35-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/core/pyproject.toml

+7
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,20 @@ classmethod-decorators = [ "classmethod", "langchain_core.utils.pydantic.pre_ini
8484
[tool.poetry.group.lint.dependencies]
8585
ruff = "^0.5"
8686

87+
8788
[tool.poetry.group.typing.dependencies]
8889
mypy = ">=1.10,<1.11"
8990
types-pyyaml = "^6.0.12.2"
9091
types-requests = "^2.28.11.5"
9192
types-jinja2 = "^2.11.9"
9293

94+
9395
[tool.poetry.group.dev.dependencies]
9496
jupyter = "^1.0.0"
9597
setuptools = "^67.6.1"
9698
grandalf = "^0.8"
9799

100+
98101
[tool.poetry.group.test.dependencies]
99102
pytest = "^8"
100103
freezegun = "^1.2.2"
@@ -105,6 +108,7 @@ pytest-asyncio = "^0.21.1"
105108
grandalf = "^0.8"
106109
responses = "^0.25.0"
107110
pytest-socket = "^0.7.0"
111+
pytest-xdist = "^3.6.1"
108112
[[tool.poetry.group.test.dependencies.numpy]]
109113
version = "^1.24.0"
110114
python = "<3.12"
@@ -113,12 +117,15 @@ python = "<3.12"
113117
version = ">=1.26.0,<3"
114118
python = ">=3.12"
115119

120+
116121
[tool.poetry.group.test_integration.dependencies]
117122

123+
118124
[tool.poetry.group.typing.dependencies.langchain-text-splitters]
119125
path = "../text-splitters"
120126
develop = true
121127

128+
122129
[tool.poetry.group.test.dependencies.langchain-tests]
123130
path = "../standard-tests"
124131
develop = true

libs/langchain/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ coverage:
1919
$(TEST_FILE)
2020

2121
test tests:
22-
poetry run pytest --disable-socket --allow-unix-socket $(TEST_FILE)
22+
poetry run pytest -n auto --disable-socket --allow-unix-socket $(TEST_FILE)
2323

2424
extended_tests:
2525
poetry run pytest --disable-socket --allow-unix-socket --only-extended tests/unit_tests

0 commit comments

Comments
 (0)