Skip to content

Commit e359bba

Browse files
Fix linting errors: revert _app to app where used, remove unused imports, fix indentation
1 parent ba383ae commit e359bba

7 files changed

Lines changed: 25 additions & 27 deletions

File tree

src/tests/ContentProcessorAPI/helpers/test_azure_credential_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import os
77
import sys
88
from unittest.mock import MagicMock, patch
9-
import pytest
109

1110
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..", "ContentProcessorAPI")))
1211

src/tests/ContentProcessorAPI/libs/test_app_configuration_helper.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import os
77
import sys
88
from unittest.mock import MagicMock, patch
9-
import pytest
109

1110
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..", "ContentProcessorAPI")))
1211

src/tests/ContentProcessorAPI/libs/test_cosmos_db_helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_find_document(mock_certifi, mock_mongo_client):
8686
mock_cursor.__iter__.return_value = iter(mock_items)
8787

8888
query = {"key": "value"}
89-
_result = helper.find_document(
89+
helper.find_document(
9090
query=query,
9191
sort_fields=[("field", 1)],
9292
skip=10,
@@ -167,7 +167,7 @@ def test_delete_document(mock_certifi, mock_mongo_client):
167167
mock_result = MagicMock()
168168
mock_container.delete_one.return_value = mock_result
169169

170-
_result = helper.delete_document("test_id")
170+
helper.delete_document(\"test_id\")
171171
mock_container.delete_one.assert_called_once_with({"Id": "test_id"})
172172

173173

src/tests/ContentProcessorWorkflow/libs/test_application_base_extended.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_initialization_with_explicit_env_file(self, tmp_path):
3838
mock_cred_instance = Mock()
3939
mock_cred.return_value = mock_cred_instance
4040

41-
_app = ConcreteApplication(env_file_path=str(env_file))
41+
app = ConcreteApplication(env_file_path=str(env_file))
4242

4343
assert app.application_context is not None
4444
assert isinstance(app.application_context, AppContext)
@@ -60,7 +60,7 @@ def test_initialization_auto_discover_env_file(self, tmp_path, monkeypatch):
6060
mock_getfile.return_value = str(test_file)
6161
mock_cred.return_value = Mock()
6262

63-
_app = ConcreteApplication()
63+
app = ConcreteApplication()
6464

6565
assert app.application_context is not None
6666
assert app.initialized is True
@@ -81,7 +81,7 @@ def test_initialization_with_app_config_endpoint(self, tmp_path, monkeypatch):
8181
mock_app_config_instance = Mock()
8282
mock_app_config.return_value = mock_app_config_instance
8383

84-
_app = ConcreteApplication(env_file_path=str(env_file))
84+
app = ConcreteApplication(env_file_path=str(env_file))
8585

8686
mock_app_config.assert_called_once()
8787
mock_app_config_instance.read_and_set_environmental_variables.assert_called_once()
@@ -101,7 +101,7 @@ def test_initialization_with_logging_enabled(self, tmp_path, monkeypatch):
101101

102102
mock_cred.return_value = Mock()
103103

104-
_app = ConcreteApplication(env_file_path=str(env_file))
104+
app = ConcreteApplication(env_file_path=str(env_file))
105105

106106
# Verify logging was configured
107107
mock_logging.assert_called_once()
@@ -122,7 +122,7 @@ def test_initialization_without_logging(self, tmp_path, monkeypatch):
122122

123123
mock_cred.return_value = Mock()
124124

125-
_app = ConcreteApplication(env_file_path=str(env_file))
125+
app = ConcreteApplication(env_file_path=str(env_file))
126126

127127
# Verify logging was NOT configured
128128
mock_logging.assert_not_called()
@@ -140,7 +140,7 @@ def test_initialization_sets_llm_settings(self, tmp_path):
140140
mock_llm_instance = Mock()
141141
mock_llm_settings.return_value = mock_llm_instance
142142

143-
_app = ConcreteApplication(env_file_path=str(env_file))
143+
app = ConcreteApplication(env_file_path=str(env_file))
144144

145145
assert app.application_context.llm_settings == mock_llm_instance
146146
mock_llm_settings.assert_called_once_with(
@@ -158,7 +158,7 @@ def test_load_env_with_explicit_path(self, tmp_path):
158158
patch('libs.base.application_base.AgentFrameworkSettings'), \
159159
patch('libs.base.application_base.load_dotenv') as mock_load_dotenv:
160160

161-
_app = ConcreteApplication(env_file_path=str(env_file))
161+
app = ConcreteApplication(env_file_path=str(env_file))
162162

163163
# Verify load_dotenv was called at least once
164164
assert mock_load_dotenv.call_count >= 1
@@ -177,7 +177,7 @@ def test_get_derived_class_location(self, tmp_path):
177177
test_env = tmp_path / ".env"
178178
test_env.write_text("APP_LOGGING_ENABLE=false\n")
179179

180-
_app = ConcreteApplication(env_file_path=str(test_env))
180+
app = ConcreteApplication(env_file_path=str(test_env))
181181

182182
location = app._get_derived_class_location()
183183

@@ -196,7 +196,7 @@ def test_application_context_credential_set(self, tmp_path):
196196
mock_cred_instance = Mock()
197197
mock_cred.return_value = mock_cred_instance
198198

199-
_app = ConcreteApplication(env_file_path=str(env_file))
199+
app = ConcreteApplication(env_file_path=str(env_file))
200200

201201
assert app.application_context.credential == mock_cred_instance
202202

@@ -211,7 +211,7 @@ def test_application_context_configuration_set(self, tmp_path, monkeypatch):
211211
patch('libs.base.application_base.AppConfigurationHelper'), \
212212
patch('libs.base.application_base.AgentFrameworkSettings'):
213213

214-
_app = ConcreteApplication(env_file_path=str(env_file))
214+
app = ConcreteApplication(env_file_path=str(env_file))
215215

216216
assert app.application_context.configuration is not None
217217

@@ -224,7 +224,7 @@ def test_run_method_called(self, tmp_path):
224224
patch('libs.base.application_base.AppConfigurationHelper'), \
225225
patch('libs.base.application_base.AgentFrameworkSettings'):
226226

227-
_app = ConcreteApplication(env_file_path=str(env_file))
227+
app = ConcreteApplication(env_file_path=str(env_file))
228228

229229
assert app.running is False
230230
app.run()
@@ -241,7 +241,7 @@ def test_initialize_method_called_during_init(self, tmp_path):
241241

242242
# initialized flag is set in ConcreteApplication.__init__ which calls super().__init__
243243
# But the initialize() method sets initialized=True
244-
_app = ConcreteApplication(env_file_path=str(env_file))
244+
app = ConcreteApplication(env_file_path=str(env_file))
245245

246246
# The initialize() method should have been called in ConcreteApplication.__init__
247247
assert app.initialized is True
@@ -257,7 +257,7 @@ def test_empty_app_config_endpoint_skipped(self, tmp_path, monkeypatch):
257257
patch('libs.base.application_base.AppConfigurationHelper') as mock_app_config, \
258258
patch('libs.base.application_base.AgentFrameworkSettings'):
259259

260-
_app = ConcreteApplication(env_file_path=str(env_file))
260+
app = ConcreteApplication(env_file_path=str(env_file))
261261

262262
# AppConfigurationHelper should not be called with empty endpoint
263263
mock_app_config.assert_not_called()
@@ -274,7 +274,7 @@ def test_none_app_config_endpoint_skipped(self, tmp_path, monkeypatch):
274274
patch('libs.base.application_base.AppConfigurationHelper') as mock_app_config, \
275275
patch('libs.base.application_base.AgentFrameworkSettings'):
276276

277-
_app = ConcreteApplication(env_file_path=str(env_file))
277+
app = ConcreteApplication(env_file_path=str(env_file))
278278

279279
# AppConfigurationHelper should not be called
280280
mock_app_config.assert_not_called()

src/tests/ContentProcessorWorkflow/libs/test_final_80_percent_push.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ def test_service_scope_get_service_not_registered(self):
1212

1313
context = AppContext()
1414

15-
1615
class UnregisteredService:
1716
pass
1817

1918
# Attempt to get unregistered service should raise or return None
2019
with pytest.raises(Exception): # KeyError or custom exception
2120
if hasattr(context, 'create_scope'):
2221
import asyncio
22+
2323
async def test():
2424
async with await context.create_scope() as scope:
2525
scope.get_service(UnregisteredService)
@@ -221,7 +221,7 @@ def test_get_azure_credential_with_all_env_vars(self):
221221
'AZURE_TENANT_ID': 'test-tenant-id',
222222
'AZURE_CLIENT_SECRET': 'test-secret'
223223
}), \
224-
patch('utils.credential_util.DefaultAzureCredential') as mock_cred:
224+
patch('utils.credential_util.DefaultAzureCredential') as mock_cred:
225225

226226
mock_cred.return_value = Mock()
227227

src/tests/ContentProcessorWorkflow/libs/test_push_to_80_percent.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def run(self):
2626
mock_env_config.return_value.app_config_endpoint = ""
2727

2828
# Test with explicit path
29-
_app = TestApp(env_file_path="/custom/path/.env")
29+
app = TestApp(env_file_path="/custom/path/.env")
3030

3131
# Should have loaded from explicit path
3232
mock_load_dotenv.assert_called_with(dotenv_path="/custom/path/.env")
@@ -43,7 +43,7 @@ def run(self):
4343
pass
4444

4545
with patch('libs.base.application_base.load_dotenv'), \
46-
patch('libs.base.application_base.DefaultAzureCredential'), \\
46+
patch('libs.base.application_base.DefaultAzureCredential'), \
4747
patch('libs.base.application_base.Configuration') as mock_config, \
4848
patch('libs.base.application_base.AgentFrameworkSettings'), \
4949
patch('libs.base.application_base._envConfiguration') as mock_env_config, \
@@ -53,7 +53,7 @@ def run(self):
5353
mock_env_config.return_value.app_config_endpoint = "https://myconfig.azconfig.io"
5454
mock_config.return_value.app_logging_enable = False
5555

56-
_app = TestApp()
56+
app = TestApp()
5757

5858
# Should have created AppConfigurationHelper
5959
assert mock_app_config.called
@@ -85,7 +85,7 @@ def run(self):
8585
config_instance.app_logging_level = "DEBUG"
8686
mock_config.return_value = config_instance
8787

88-
_app = TestApp()
88+
app = TestApp()
8989

9090
# Should have configured logging
9191
mock_logging.assert_called_once()

src/tests/ContentProcessorWorkflow/libs/test_ultra_focused_80.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_safe_log_with_complex_formatting(self):
5858

5959
logger = Mock()
6060
safe_log(logger, "info", "User {user} performed {action} on {resource}",
61-
user="alice", action="update", resource="document")
61+
user="alice", action="update", resource="document")
6262

6363
assert logger.info.called
6464
call_str = str(logger.info.call_args)
@@ -102,7 +102,7 @@ def run(self):
102102
mock_config.return_value.app_logging_enable = False
103103

104104
# Create app with no explicit env path
105-
_app = TestApp()
105+
app = TestApp()
106106

107107
# Should have called load_dotenv
108108
assert mock_load.called
@@ -119,7 +119,7 @@ def test_validate_authentication_with_kubernetes(self):
119119
'KUBERNETES_SERVICE_HOST': 'kubernetes.default.svc',
120120
'IDENTITY_ENDPOINT': 'http://169.254.169.254/metadata/identity'
121121
}), \
122-
patch('utils.credential_util.get_azure_credential') as mock_cred:
122+
patch('utils.credential_util.get_azure_credential') as mock_cred:
123123

124124
mock_cred.return_value = Mock()
125125

0 commit comments

Comments
 (0)