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.

refactor(api): enable strict typing for storage unit tests (#44389)

Eddy ZHANG488822e66975
diff --git a/api/tests/unit_tests/.ruff.toml b/api/tests/unit_tests/.ruff.toml
index 978433b0006..ede09ab84c2 100644
--- a/api/tests/unit_tests/.ruff.toml
+++ b/api/tests/unit_tests/.ruff.toml
@@ -250,16 +250,6 @@ extend-select = ["ANN401", "ARG"]
"libs/test_email_i18n.py" = ["ANN401", "TID251"]
"libs/test_schedule_utils_enhanced.py" = ["S110"]
"models/test_dataset_models.py" = ["ARG005"]
-"oss/__mock/aliyun_oss.py" = ["ARG002"]
-"oss/__mock/baidu_obs.py" = ["ARG002"]
-"oss/__mock/base.py" = ["ARG002"]
-"oss/__mock/tencent_cos.py" = ["ARG002"]
-"oss/__mock/volcengine_tos.py" = ["ARG002"]
-"oss/aliyun_oss/aliyun_oss/test_aliyun_oss.py" = ["ARG002"]
-"oss/baidu_obs/test_baidu_obs.py" = ["ARG002"]
-"oss/opendal/test_opendal.py" = ["ARG002"]
-"oss/tencent_cos/test_tencent_cos.py" = ["ARG002"]
-"oss/volcengine_tos/test_volcengine_tos.py" = ["ARG002"]
"services/agent/test_agent_observability_service.py" = ["ARG002", "ARG005"]
"services/agent/test_agent_services.py" = ["ARG001", "ARG002", "ARG003", "ARG005"]
"services/agent/test_prompt_mentions.py" = ["ARG005"]
diff --git a/api/tests/unit_tests/oss/__mock/aliyun_oss.py b/api/tests/unit_tests/oss/__mock/aliyun_oss.py
index 6138990c884..e47644802bf 100644
--- a/api/tests/unit_tests/oss/__mock/aliyun_oss.py
+++ b/api/tests/unit_tests/oss/__mock/aliyun_oss.py
@@ -1,5 +1,7 @@
import os
import posixpath
+from collections.abc import Generator
+from dataclasses import dataclass
import pytest
from oss2 import Bucket
@@ -16,30 +18,15 @@ from tests.unit_tests.oss.__mock.base import (
)
+@dataclass
class MockResponse:
- def __init__(self, status, headers, request_id):
- self.status = status
- self.headers = headers
- self.request_id = request_id
+ status: int
+ headers: dict[str, str]
+ request_id: str
class MockAliyunOssClass:
- def __init__(
- self,
- auth,
- endpoint,
- bucket_name,
- is_cname=False,
- session=None,
- connect_timeout=None,
- app_name="",
- enable_crc=True,
- proxies=None,
- region=None,
- cloudbox_id=None,
- is_path_style=False,
- is_verify_object_strict=True,
- ):
+ def __init__(self, *_args: object, **_kwargs: object) -> None:
self.bucket_name = get_example_bucket()
self.key = posixpath.join(get_example_folder(), get_example_filename())
self.content = get_example_data()
@@ -53,31 +40,29 @@ class MockAliyunOssClass:
"request_id",
)
- def put_object(self, key, data, headers=None, progress_callback=None):
+ def put_object(self, key: str, data: bytes) -> PutObjectResult:
assert key == self.key
assert data == self.content
return PutObjectResult(self.resp)
- def get_object(self, key, byte_range=None, headers=None, progress_callback=None, process=None, params=None):
+ def get_object(self, key: str) -> GetObjectResult:
assert key == self.key
response = object_response(self.content)
response.headers.update(self.resp.headers)
return GetObjectResult(OssResponse(response))
- def get_object_to_file(
- self, key, filename, byte_range=None, headers=None, progress_callback=None, process=None, params=None
- ):
+ def get_object_to_file(self, key: str, filename: str) -> None:
assert key == self.key
assert filename == self.filepath
- def object_exists(self, key, headers=None):
+ def object_exists(self, key: str) -> bool:
assert key == self.key
return True
- def delete_object(self, key, params=None, headers=None):
+ def delete_object(self, key: str) -> MockResponse:
assert key == self.key
- self.resp.headers["x-oss-delete-marker"] = True
+ self.resp.headers["x-oss-delete-marker"] = "true"
return self.resp
@@ -85,7 +70,7 @@ MOCK = os.getenv("MOCK_SWITCH", "false").lower() == "true"
@pytest.fixture
-def setup_aliyun_oss_mock(monkeypatch: pytest.MonkeyPatch):
+def setup_aliyun_oss_mock(monkeypatch: pytest.MonkeyPatch) -> Generator[None]:
if MOCK:
monkeypatch.setattr(Bucket, "__init__", MockAliyunOssClass.__init__)
monkeypatch.setattr(Bucket, "put_object", MockAliyunOssClass.put_object)
diff --git a/api/tests/unit_tests/oss/__mock/baidu_obs.py b/api/tests/unit_tests/oss/__mock/baidu_obs.py
index 49c0830cdfb..3a9d68f9db7 100644
--- a/api/tests/unit_tests/oss/__mock/baidu_obs.py
+++ b/api/tests/unit_tests/oss/__mock/baidu_obs.py
@@ -1,6 +1,7 @@
import base64
import hashlib
import os
+from collections.abc import Generator
from io import BytesIO
from types import SimpleNamespace
@@ -16,13 +17,13 @@ from tests.unit_tests.oss.__mock.base import (
class MockBaiduObsClass:
- def __init__(self, config=None):
+ def __init__(self, *_args: object, **_kwargs: object) -> None:
self.bucket_name = get_example_bucket()
self.key = get_example_filename()
self.content = get_example_data()
self.filepath = get_example_filepath()
- def put_object(self, bucket_name, key, data, content_length=None, content_md5=None, **kwargs):
+ def put_object(self, bucket_name: str, key: str, data: bytes, content_length: int, content_md5: bytes) -> None:
assert bucket_name == self.bucket_name
assert key == self.key
assert data == self.content
@@ -30,22 +31,22 @@ class MockBaiduObsClass:
expected_md5 = base64.standard_b64encode(hashlib.md5(self.content).digest())
assert content_md5 == expected_md5
- def get_object(self, bucket_name, key, **kwargs):
+ def get_object(self, bucket_name: str, key: str) -> SimpleNamespace:
assert bucket_name == self.bucket_name
assert key == self.key
return SimpleNamespace(data=BytesIO(self.content))
- def get_object_to_file(self, bucket_name, key, file_name, **kwargs):
+ def get_object_to_file(self, bucket_name: str, key: str, file_name: str) -> None:
assert bucket_name == self.bucket_name
assert key == self.key
assert file_name == self.filepath
- def get_object_meta_data(self, bucket_name, key, **kwargs):
+ def get_object_meta_data(self, bucket_name: str, key: str) -> SimpleNamespace:
assert bucket_name == self.bucket_name
assert key == self.key
return SimpleNamespace(status=200)
- def delete_object(self, bucket_name, key, **kwargs):
+ def delete_object(self, bucket_name: str, key: str) -> None:
assert bucket_name == self.bucket_name
assert key == self.key
@@ -54,7 +55,7 @@ MOCK = os.getenv("MOCK_SWITCH", "false").lower() == "true"
@pytest.fixture
-def setup_baidu_obs_mock(monkeypatch: pytest.MonkeyPatch):
+def setup_baidu_obs_mock(monkeypatch: pytest.MonkeyPatch) -> Generator[None]:
if MOCK:
monkeypatch.setattr(BosClient, "__init__", MockBaiduObsClass.__init__)
monkeypatch.setattr(BosClient, "put_object", MockBaiduObsClass.put_object)
diff --git a/api/tests/unit_tests/oss/__mock/base.py b/api/tests/unit_tests/oss/__mock/base.py
index dfcdc70d9fd..beec7fdfd7f 100644
--- a/api/tests/unit_tests/oss/__mock/base.py
+++ b/api/tests/unit_tests/oss/__mock/base.py
@@ -46,33 +46,33 @@ def get_example_filepath() -> str:
class BaseStorageTest:
@pytest.fixture(autouse=True)
- def setup_method(self, *args, **kwargs):
+ def setup_method(self, *_args: object, **_kwargs: object) -> None:
"""Should be implemented in child classes to setup specific storage."""
self.storage: BaseStorage
- def test_save(self):
+ def test_save(self) -> None:
"""Test saving data."""
self.storage.save(get_example_filename(), get_example_data())
- def test_load_once(self):
+ def test_load_once(self) -> None:
"""Test loading data once."""
assert self.storage.load_once(get_example_filename()) == get_example_data()
- def test_load_stream(self):
+ def test_load_stream(self) -> None:
"""Test loading data as a stream."""
generator = self.storage.load_stream(get_example_filename())
assert isinstance(generator, Generator)
assert next(generator) == get_example_data()
assert list(generator) == []
- def test_download(self):
+ def test_download(self) -> None:
"""Test downloading data."""
self.storage.download(get_example_filename(), get_example_filepath())
- def test_exists(self):
+ def test_exists(self) -> None:
"""Test checking if a file exists."""
assert self.storage.exists(get_example_filename())
- def test_delete(self):
+ def test_delete(self) -> None:
"""Test deleting a file."""
self.storage.delete(get_example_filename())
diff --git a/api/tests/unit_tests/oss/__mock/local.py b/api/tests/unit_tests/oss/__mock/local.py
index ee01ab2a6ae..92f42bb2ef2 100644
--- a/api/tests/unit_tests/oss/__mock/local.py
+++ b/api/tests/unit_tests/oss/__mock/local.py
@@ -1,5 +1,6 @@
import os
import shutil
+from collections.abc import Generator
from pathlib import Path
from unittest.mock import MagicMock, mock_open, patch
@@ -14,24 +15,24 @@ from tests.unit_tests.oss.__mock.base import (
class MockLocalFSClass:
- def write_bytes(self, data):
+ def write_bytes(self, data: bytes) -> None:
assert data == get_example_data()
- def read_bytes(self):
+ def read_bytes(self) -> bytes:
return get_example_data()
@staticmethod
- def copyfile(src, dst):
+ def copyfile(src: str, dst: str) -> None:
assert src == os.path.join(get_example_folder(), get_example_filename())
assert dst == get_example_filepath()
@staticmethod
- def exists(path):
+ def exists(path: str) -> bool:
assert path == os.path.join(get_example_folder(), get_example_filename())
return True
@staticmethod
- def remove(path):
+ def remove(path: str) -> None:
assert path == os.path.join(get_example_folder(), get_example_filename())
@@ -39,7 +40,7 @@ MOCK = os.getenv("MOCK_SWITCH", "false").lower() == "true"
@pytest.fixture
-def setup_local_fs_mock(monkeypatch: pytest.MonkeyPatch):
+def setup_local_fs_mock(monkeypatch: pytest.MonkeyPatch) -> Generator[None]:
if MOCK:
monkeypatch.setattr(Path, "write_bytes", MockLocalFSClass.write_bytes)
monkeypatch.setattr(Path, "read_bytes", MockLocalFSClass.read_bytes)
diff --git a/api/tests/unit_tests/oss/__mock/tencent_cos.py b/api/tests/unit_tests/oss/__mock/tencent_cos.py
index 40fe96a0d78..8fcf7666ce4 100644
--- a/api/tests/unit_tests/oss/__mock/tencent_cos.py
+++ b/api/tests/unit_tests/oss/__mock/tencent_cos.py
@@ -1,4 +1,5 @@
import os
+from collections.abc import Generator
import pytest
from qcloud_cos import CosS3Client
@@ -12,38 +13,41 @@ from tests.unit_tests.oss.__mock.base import (
object_response,
)
+# CosS3Client returns the response headers as a dict.
+type _CosHeaders = dict[str, str | int | bool]
+
class MockTencentCosClass:
- def __init__(self, conf, retry=1, session=None):
+ def __init__(self, *_args: object, **_kwargs: object) -> None:
self.bucket_name = get_example_bucket()
self.key = get_example_filename()
self.content = get_example_data()
self.filepath = get_example_filepath()
- self.resp = {
+ self.resp: _CosHeaders = {
"ETag": "ee8de918d05640145b18f70f4c3aa602",
"Server": "tencent-cos",
"x-cos-hash-crc64ecma": 16749565679157681890,
"x-cos-request-id": "NWU5MDNkYzlfNjRiODJhMDlfMzFmYzhfMTFm****",
}
- def put_object(self, Bucket, Body, Key, EnableMD5=False, **kwargs): # noqa: N803
+ def put_object(self, Bucket: str, Body: bytes, Key: str) -> _CosHeaders: # noqa: N803
assert Bucket == self.bucket_name
assert Key == self.key
assert Body == self.content
return self.resp
- def get_object(self, Bucket, Key, KeySimplifyCheck=True, **kwargs): # noqa: N803
+ def get_object(self, Bucket: str, Key: str) -> dict[str, StreamBody]: # noqa: N803
assert Bucket == self.bucket_name
assert Key == self.key
return {"Body": StreamBody(object_response(self.content))}
- def object_exists(self, Bucket, Key): # noqa: N803
+ def object_exists(self, Bucket: str, Key: str) -> bool: # noqa: N803
assert Bucket == self.bucket_name
assert Key == self.key
return True
- def delete_object(self, Bucket, Key, **kwargs): # noqa: N803
+ def delete_object(self, Bucket: str, Key: str) -> _CosHeaders: # noqa: N803
assert Bucket == self.bucket_name
assert Key == self.key
self.resp.update({"x-cos-delete-marker": True})
@@ -54,7 +58,7 @@ MOCK = os.getenv("MOCK_SWITCH", "false").lower() == "true"
@pytest.fixture
-def setup_tencent_cos_mock(monkeypatch: pytest.MonkeyPatch):
+def setup_tencent_cos_mock(monkeypatch: pytest.MonkeyPatch) -> Generator[None]:
if MOCK:
monkeypatch.setattr(CosS3Client, "__init__", MockTencentCosClass.__init__)
monkeypatch.setattr(CosS3Client, "put_object", MockTencentCosClass.put_object)
diff --git a/api/tests/unit_tests/oss/__mock/volcengine_tos.py b/api/tests/unit_tests/oss/__mock/volcengine_tos.py
index 6b9a9199422..ceb6fd463c4 100644
--- a/api/tests/unit_tests/oss/__mock/volcengine_tos.py
+++ b/api/tests/unit_tests/oss/__mock/volcengine_tos.py
@@ -1,5 +1,6 @@
import os
from collections import UserDict
+from collections.abc import Generator
import pytest
from tos import TosClientV2
@@ -15,13 +16,13 @@ from tests.unit_tests.oss.__mock.base import (
)
-class AttrDict(UserDict):
- def __getattr__(self, item):
+class AttrDict(UserDict[str, object]):
+ def __getattr__(self, item: str) -> object:
return self.get(item)
class MockVolcengineTosClass:
- def __init__(self, ak="", sk="", endpoint="", region=""):
+ def __init__(self, *_args: object, **_kwargs: object) -> None:
self.bucket_name = get_example_bucket()
self.key = get_example_filename()
self.content = get_example_data()
@@ -42,7 +43,7 @@ class MockVolcengineTosClass:
}
)
- def put_object(self, bucket: str, key: str, content=None) -> PutObjectOutput:
+ def put_object(self, bucket: str, key: str, content: bytes) -> PutObjectOutput:
assert bucket == self.bucket_name
assert key == self.key
assert content == self.content
@@ -54,7 +55,7 @@ class MockVolcengineTosClass:
return GetObjectOutput(TosResponse(object_response(self.content)))
- def get_object_to_file(self, bucket: str, key: str, file_path: str):
+ def get_object_to_file(self, bucket: str, key: str, file_path: str) -> None:
assert bucket == self.bucket_name
assert key == self.key
assert file_path == self.filepath
@@ -64,7 +65,7 @@ class MockVolcengineTosClass:
assert key == self.key
return HeadObjectOutput(self.resp)
- def delete_object(self, bucket: str, key: str):
+ def delete_object(self, bucket: str, key: str) -> DeleteObjectOutput:
assert bucket == self.bucket_name
assert key == self.key
return DeleteObjectOutput(self.resp)
@@ -74,7 +75,7 @@ MOCK = os.getenv("MOCK_SWITCH", "false").lower() == "true"
@pytest.fixture
-def setup_volcengine_tos_mock(monkeypatch: pytest.MonkeyPatch):
+def setup_volcengine_tos_mock(monkeypatch: pytest.MonkeyPatch) -> Generator[None]:
if MOCK:
monkeypatch.setattr(TosClientV2, "__init__", MockVolcengineTosClass.__init__)
monkeypatch.setattr(TosClientV2, "put_object", MockVolcengineTosClass.put_object)
diff --git a/api/tests/unit_tests/oss/aliyun_oss/aliyun_oss/test_aliyun_oss.py b/api/tests/unit_tests/oss/aliyun_oss/aliyun_oss/test_aliyun_oss.py
index 52abfdd72ed..021ad994e7a 100644
--- a/api/tests/unit_tests/oss/aliyun_oss/aliyun_oss/test_aliyun_oss.py
+++ b/api/tests/unit_tests/oss/aliyun_oss/aliyun_oss/test_aliyun_oss.py
@@ -1,3 +1,4 @@
+from typing import override
from unittest.mock import patch
import pytest
@@ -15,7 +16,8 @@ pytest_plugins = ("tests.unit_tests.oss.__mock.aliyun_oss",)
class TestAliyunOss(BaseStorageTest):
@pytest.fixture(autouse=True)
- def setup_method(self, setup_aliyun_oss_mock):
+ @override
+ def setup_method(self, setup_aliyun_oss_mock: None) -> None:
"""Executed before each test method."""
with patch.object(Auth, "__init__", return_value=None):
self.storage = AliyunOssStorage()
diff --git a/api/tests/unit_tests/oss/baidu_obs/test_baidu_obs.py b/api/tests/unit_tests/oss/baidu_obs/test_baidu_obs.py
index 053f8112641..38b9c71d530 100644
--- a/api/tests/unit_tests/oss/baidu_obs/test_baidu_obs.py
+++ b/api/tests/unit_tests/oss/baidu_obs/test_baidu_obs.py
@@ -1,3 +1,4 @@
+from typing import override
from unittest.mock import MagicMock, patch
import pytest
@@ -15,7 +16,8 @@ pytest_plugins = ("tests.unit_tests.oss.__mock.baidu_obs",)
class TestBaiduObs(BaseStorageTest):
@pytest.fixture(autouse=True)
- def setup_method(self, setup_baidu_obs_mock):
+ @override
+ def setup_method(self, setup_baidu_obs_mock: None) -> None:
"""Executed before each test method."""
with (
patch.object(BceCredentials, "__init__", return_value=None),
@@ -26,7 +28,7 @@ class TestBaiduObs(BaseStorageTest):
class TestBaiduObsConfiguration:
- def test_init_with_config(self):
+ def test_init_with_config(self) -> None:
mock_dify_config = MagicMock()
mock_dify_config.BAIDU_OBS_BUCKET_NAME = "test-bucket"
mock_dify_config.BAIDU_OBS_ACCESS_KEY = "test-access-key"
diff --git a/api/tests/unit_tests/oss/opendal/test_opendal.py b/api/tests/unit_tests/oss/opendal/test_opendal.py
index b83ad72b34d..11bbf5f1933 100644
--- a/api/tests/unit_tests/oss/opendal/test_opendal.py
+++ b/api/tests/unit_tests/oss/opendal/test_opendal.py
@@ -13,7 +13,7 @@ from tests.unit_tests.oss.__mock.base import (
class TestOpenDAL:
@pytest.fixture(autouse=True)
- def setup_method(self, *args, **kwargs):
+ def setup_method(self) -> None:
"""Executed before each test method."""
self.storage = OpenDALStorage(
scheme="fs",
@@ -21,7 +21,7 @@ class TestOpenDAL:
)
@pytest.fixture(scope="class", autouse=True)
- def teardown_class(self):
+ def teardown_class(self) -> Generator[None]:
"""Clean up after all tests in the class."""
yield
@@ -32,7 +32,7 @@ class TestOpenDAL:
shutil.rmtree(folder, ignore_errors=True)
- def test_save_and_exists(self):
+ def test_save_and_exists(self) -> None:
"""Test saving data and checking existence."""
filename = get_example_filename()
data = get_example_data()
@@ -41,7 +41,7 @@ class TestOpenDAL:
self.storage.save(filename, data)
assert self.storage.exists(filename)
- def test_load_once(self):
+ def test_load_once(self) -> None:
"""Test loading data once."""
filename = get_example_filename()
data = get_example_data()
@@ -50,7 +50,7 @@ class TestOpenDAL:
loaded_data = self.storage.load_once(filename)
assert loaded_data == data
- def test_load_stream(self):
+ def test_load_stream(self) -> None:
"""Test loading data as a stream."""
filename = get_example_filename()
chunks = 5
@@ -67,7 +67,7 @@ class TestOpenDAL:
with pytest.raises(StopIteration):
next(generator)
- def test_download(self):
+ def test_download(self) -> None:
"""Test downloading data to a file."""
filename = get_example_filename()
filepath = str(Path(get_opendal_bucket()) / filename)
@@ -76,7 +76,7 @@ class TestOpenDAL:
self.storage.save(filename, data)
self.storage.download(filename, filepath)
- def test_delete(self):
+ def test_delete(self) -> None:
"""Test deleting a file."""
filename = get_example_filename()
data = get_example_data()
diff --git a/api/tests/unit_tests/oss/tencent_cos/test_tencent_cos.py b/api/tests/unit_tests/oss/tencent_cos/test_tencent_cos.py
index 76a88e8a116..96fb8c8abc8 100644
--- a/api/tests/unit_tests/oss/tencent_cos/test_tencent_cos.py
+++ b/api/tests/unit_tests/oss/tencent_cos/test_tencent_cos.py
@@ -1,4 +1,5 @@
from pathlib import Path
+from typing import override
from unittest.mock import MagicMock, patch
import pytest
@@ -17,13 +18,16 @@ pytest_plugins = ("tests.unit_tests.oss.__mock.tencent_cos",)
class TestTencentCos(BaseStorageTest):
@pytest.fixture(autouse=True)
- def setup_method(self, setup_tencent_cos_mock):
+ @override
+ def setup_method(self, setup_tencent_cos_mock: None) -> None:
"""Executed before each test method."""
with patch.object(CosConfig, "__init__", return_value=None, autospec=True):
self.storage = TencentCosStorage()
self.storage.bucket_name = get_example_bucket()
- def test_download(self, tmp_path: Path):
+ # Replaces the base test so the download lands in tmp_path; the extra fixture argument narrows the signature.
+ @override
+ def test_download(self, tmp_path: Path) -> None: # pyrefly: ignore[bad-override]
destination = tmp_path / "download.txt"
self.storage.download(get_example_filename(), str(destination))
assert destination.read_bytes() == get_example_data()
@@ -32,7 +36,7 @@ class TestTencentCos(BaseStorageTest):
class TestTencentCosConfiguration:
"""Tests for TencentCosStorage initialization with different configurations."""
- def test_init_with_custom_domain(self):
+ def test_init_with_custom_domain(self) -> None:
"""Test initialization with custom domain configured."""
# Mock dify_config to return custom domain configuration
mock_dify_config = MagicMock()
@@ -64,7 +68,7 @@ class TestTencentCosConfiguration:
assert call_kwargs["SecretKey"] == "test-secret-key"
assert call_kwargs["Scheme"] == "https"
- def test_init_with_region(self):
+ def test_init_with_region(self) -> None:
"""Test initialization with region configured (no custom domain)."""
# Mock dify_config to return region configuration
mock_dify_config = MagicMock()
diff --git a/api/tests/unit_tests/oss/volcengine_tos/test_volcengine_tos.py b/api/tests/unit_tests/oss/volcengine_tos/test_volcengine_tos.py
index d33988be741..8d7733e1039 100644
--- a/api/tests/unit_tests/oss/volcengine_tos/test_volcengine_tos.py
+++ b/api/tests/unit_tests/oss/volcengine_tos/test_volcengine_tos.py
@@ -1,3 +1,6 @@
+from collections.abc import Callable
+from typing import override
+
import pytest
from tos import TosClientV2
@@ -12,7 +15,8 @@ pytest_plugins = ("tests.unit_tests.oss.__mock.volcengine_tos",)
class TestVolcengineTos(BaseStorageTest):
@pytest.fixture(autouse=True)
- def setup_method(self, setup_volcengine_tos_mock, config_overrides):
+ @override
+ def setup_method(self, setup_volcengine_tos_mock: None, config_overrides: Callable[..., None]) -> None:
"""Executed before each test method."""
config_overrides(
VOLCENGINE_TOS_ACCESS_KEY="test_access_key",
diff --git a/api/tests/unit_tests/pyrefly.toml b/api/tests/unit_tests/pyrefly.toml
index 652fefbadf5..887a879d1c8 100644
--- a/api/tests/unit_tests/pyrefly.toml
+++ b/api/tests/unit_tests/pyrefly.toml
@@ -493,17 +493,6 @@ project-excludes = [
"models/test_dataset_models.py",
"models/test_tool_models.py",
"models/test_workflow.py",
- "oss/__mock/aliyun_oss.py",
- "oss/__mock/baidu_obs.py",
- "oss/__mock/base.py",
- "oss/__mock/local.py",
- "oss/__mock/tencent_cos.py",
- "oss/__mock/volcengine_tos.py",
- "oss/aliyun_oss/aliyun_oss/test_aliyun_oss.py",
- "oss/baidu_obs/test_baidu_obs.py",
- "oss/opendal/test_opendal.py",
- "oss/tencent_cos/test_tencent_cos.py",
- "oss/volcengine_tos/test_volcengine_tos.py",
"repositories/test_sqlalchemy_api_workflow_run_repository.py",
"services/agent/test_agent_dsl_service.py",
"services/agent/test_agent_observability_service.py",