Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

perf(api): disable unused SDK pytest plugins (#43125)

Stephen Zhouaf7f6abb95ea
diff --git a/.github/workflows/api-tests.yml b/.github/workflows/api-tests.yml
index 62c2bee977f..d4979a04cfd 100644
--- a/.github/workflows/api-tests.yml
+++ b/.github/workflows/api-tests.yml
@@ -117,7 +117,7 @@ jobs:
-p no:benchmark \
--timeout "${PYTEST_TIMEOUT:-20}" \
-n auto \
- -o 'addopts=--cov=./api --cov-branch --import-mode=importlib' \
+ -o 'addopts=-p no:opik -p no:langsmith_plugin --cov=./api --cov-branch --import-mode=importlib' \
--cov-report= \
--file-shard-plan unit-test-plan.json \
--shard-index "${{ matrix.shardIndex }}" \
@@ -181,7 +181,7 @@ jobs:
run: |
uv run --project api pytest \
--timeout "${PYTEST_TIMEOUT:-20}" \
- -o 'addopts=--cov=./api --cov-branch --import-mode=importlib' \
+ -o 'addopts=-p no:opik -p no:langsmith_plugin --cov=./api --cov-branch --import-mode=importlib' \
--cov-report= \
--junitxml=test-results/controllers.xml \
api/tests/unit_tests/controllers
@@ -246,7 +246,7 @@ jobs:
--start-middleware \
--middleware-stop-timeout 2 \
-n auto \
- -o 'addopts=--cov=./api --cov-branch --import-mode=importlib' \
+ -o 'addopts=-p no:opik -p no:langsmith_plugin --cov=./api --cov-branch --import-mode=importlib' \
--cov-report= \
--timeout "${PYTEST_TIMEOUT:-180}" \
api/tests/integration_tests/workflow \
diff --git a/api/pytest.ini b/api/pytest.ini
index 4d5d0ab6e09..9958e8e1447 100644
--- a/api/pytest.ini
+++ b/api/pytest.ini
@@ -1,6 +1,8 @@
[pytest]
pythonpath = .
-addopts = --cov=./api --cov-report=json --import-mode=importlib --cov-branch --cov-report=xml
+# These optional SDK plugins are not used by the backend suite. In particular,
+# Opik eagerly imports LiteLLM, which also loads the developer's .env into os.environ.
+addopts = -p no:opik -p no:langsmith_plugin --cov=./api --cov-report=json --import-mode=importlib --cov-branch --cov-report=xml
env =
ANTHROPIC_API_KEY = sk-ant-api11-IamNotARealKeyJustForMockTestKawaiiiiiiiiii-NotBaka-ASkksz
AZURE_OPENAI_API_BASE = https://difyai-openai.openai.azure.com