Skip to content

Commit 9aa0490

Browse files
Merge pull request #808 from microsoft/code-quality-fix
refactor: Code quality fix
2 parents fba0395 + 3b8654f commit 9aa0490

26 files changed

Lines changed: 28 additions & 82 deletions

src/tests/backend/auth/test_auth_utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
import pytest
66
import base64
77
import json
8-
import logging
98
import sys
109
import os
11-
import importlib.util
1210
from unittest.mock import patch, MagicMock
1311

1412
# Add the source root directory to the Python path for imports

src/tests/backend/common/config/test_app_config.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
import os
1414
import logging
1515
from unittest.mock import patch, MagicMock, AsyncMock
16-
from azure.identity import DefaultAzureCredential, ManagedIdentityCredential
17-
from azure.cosmos import CosmosClient
18-
from azure.ai.projects.aio import AIProjectClient
1916

2017
# Add the source root directory to the Python path for imports
2118
import sys

src/tests/backend/common/database/test_cosmosdb.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
import logging
55
import sys
66
import os
7-
from typing import Any, Dict, List, Optional
8-
from unittest.mock import AsyncMock, MagicMock, Mock, patch
7+
from unittest.mock import AsyncMock, Mock, patch
98
import pytest
10-
import uuid
119

1210
# Add the backend directory to the Python path
1311
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'backend'))

src/tests/backend/common/database/test_database_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import sys
44
import os
5-
from abc import ABC, abstractmethod
5+
from abc import ABC
66
from typing import Any, Dict, List, Optional, Type
7-
from unittest.mock import AsyncMock, Mock, patch
7+
from unittest.mock import Mock
88
import pytest
99

1010
# Add the backend directory to the Python path

src/tests/backend/common/database/test_database_factory.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import logging
44
import sys
55
import os
6-
from typing import Optional
7-
from unittest.mock import AsyncMock, Mock, patch, MagicMock
6+
from unittest.mock import AsyncMock, Mock, patch
87
import pytest
98

109
# Add the backend directory to the Python path

src/tests/backend/common/utils/test_event_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44
import sys
55
import os
6-
from unittest.mock import Mock, patch, MagicMock
6+
from unittest.mock import Mock, patch
77
import pytest
88

99
# Mock external dependencies at module level

src/tests/backend/common/utils/test_otlp_tracing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import sys
44
import os
5-
from unittest.mock import Mock, patch, MagicMock, call
5+
from unittest.mock import Mock, patch, call
66
import pytest
77

88
# Mock external dependencies at module level

src/tests/backend/common/utils/test_utils_af.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
"""Unit tests for utils_af module."""
22

3-
import logging
43
import sys
54
import os
6-
import uuid
7-
from unittest.mock import Mock, patch, AsyncMock, MagicMock
5+
from unittest.mock import Mock, patch, AsyncMock
86
import pytest
97

108
# Add the backend directory to the Python path

src/tests/backend/common/utils/test_utils_agents.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
This module tests the utility functions for agent ID generation and database operations.
55
"""
66

7-
import logging
87
import string
98
import sys
109
import unittest
@@ -33,10 +32,8 @@
3332
sys.modules['common.models'] = Mock()
3433
sys.modules['common.models.messages_af'] = Mock()
3534

36-
import pytest
37-
3835
from backend.common.database.database_base import DatabaseBase
39-
from backend.common.models.messages_af import CurrentTeamAgent, DataType, TeamConfiguration
36+
from backend.common.models.messages_af import CurrentTeamAgent, TeamConfiguration
4037
from backend.common.utils.utils_agents import (
4138
generate_assistant_id,
4239
get_database_team_agent_id,

src/tests/backend/common/utils/test_utils_date.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,12 @@
77

88
import json
99
import locale
10-
import logging
1110
import unittest
1211
import sys
1312
import os
1413
from datetime import datetime
15-
from typing import Optional
1614
from unittest.mock import Mock, patch
1715

18-
import pytest
19-
2016
# Add the backend directory to the Python path
2117
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'backend'))
2218

@@ -90,9 +86,6 @@ def mock_parse(date_str):
9086
import re as real_re
9187
utils_date_module.re = real_re
9288

93-
# Import dateutil.parser after mocking to avoid import errors
94-
from dateutil import parser
95-
9689

9790
class TestFormatDateForUser(unittest.TestCase):
9891
"""Test cases for format_date_for_user function."""

0 commit comments

Comments
 (0)