Skip to content

Commit ba383ae

Browse files
Fix remaining linting errors: add missing pytest imports, fix unused variables, fix indentation
1 parent 6cadc8e commit ba383ae

9 files changed

Lines changed: 27 additions & 26 deletions

src/tests/ContentProcessor/libs/test_application_context_extended.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Extended tests for application_context.py to improve coverage"""
2+
import pytest
23
from unittest.mock import Mock
34
from libs.application.application_context import (
45
ServiceLifetime,

src/tests/ContentProcessor/libs/test_final_push_80.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def test_data_pipeline_update_status(self):
1010
from libs.pipeline.entities.pipeline_data import DataPipeline
1111
from libs.pipeline.entities.pipeline_status import PipelineStatus
1212

13-
# Create with required fields
13+
# Create with required fields
1414
with patch('libs.pipeline.entities.pipeline_data.datetime') as mock_dt:
1515
mock_dt.now.return_value.isoformat.return_value = "2026-03-24T00:00:00"
1616

src/tests/ContentProcessor/libs/test_utils_coverage_boost.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""Targeted tests for small utility gaps to reach 80%"""
2-
from unittest.mock import patch
32

43

54
class TestBase64Util:

src/tests/ContentProcessor/utils/test_azure_credential_utils_extended.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Extended tests for azure_credential_utils.py to improve coverage"""
2+
import pytest
23
from unittest.mock import Mock, patch
34
from libs.utils.azure_credential_utils import (
45
get_azure_credential,

src/tests/ContentProcessorAPI/libs/test_cosmos_db_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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+
_result = 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Targeted tests to reach 80% coverage for ContentProcessorWorkflow"""
2+
import pytest
23
from unittest.mock import Mock, patch
34

45

@@ -10,7 +11,7 @@ def test_service_scope_get_service_not_registered(self):
1011
from libs.application.application_context import AppContext
1112

1213
context = AppContext()
13-
_scope = context._scopes.get("default", None)
14+
1415

1516
class UnregisteredService:
1617
pass

src/tests/ContentProcessorWorkflow/libs/test_push_to_80_percent.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class TestApplicationBaseComplete:
99
def test_application_base_with_explicit_env_path(self):
1010
"""Test ApplicationBase with explicit env file path"""
1111
from libs.base.application_base import ApplicationBase
12-
from libs.application.application_context import AppContext
1312

1413
class TestApp(ApplicationBase):
1514
def initialize(self):
@@ -27,7 +26,7 @@ def run(self):
2726
mock_env_config.return_value.app_config_endpoint = ""
2827

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

3231
# Should have loaded from explicit path
3332
mock_load_dotenv.assert_called_with(dotenv_path="/custom/path/.env")
@@ -44,7 +43,7 @@ def run(self):
4443
pass
4544

4645
with patch('libs.base.application_base.load_dotenv'), \
47-
patch('libs.base.application_base.DefaultAzureCredential') as mock_cred, \
46+
patch('libs.base.application_base.DefaultAzureCredential'), \\
4847
patch('libs.base.application_base.Configuration') as mock_config, \
4948
patch('libs.base.application_base.AgentFrameworkSettings'), \
5049
patch('libs.base.application_base._envConfiguration') as mock_env_config, \
@@ -54,7 +53,7 @@ def run(self):
5453
mock_env_config.return_value.app_config_endpoint = "https://myconfig.azconfig.io"
5554
mock_config.return_value.app_logging_enable = False
5655

57-
app = TestApp()
56+
_app = TestApp()
5857

5958
# Should have created AppConfigurationHelper
6059
assert mock_app_config.called
@@ -86,7 +85,7 @@ def run(self):
8685
config_instance.app_logging_level = "DEBUG"
8786
mock_config.return_value = config_instance
8887

89-
app = TestApp()
88+
_app = TestApp()
9089

9190
# Should have configured logging
9291
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
@@ -20,7 +20,7 @@ class TestService:
2020
cleanup_method=None
2121
)
2222

23-
assert descriptor.service_type ==TestService
23+
assert descriptor.service_type == TestService
2424
assert descriptor.lifetime == ServiceLifetime.SINGLETON
2525
assert descriptor.is_async is False
2626

@@ -83,7 +83,7 @@ class TestApplicationBaseMissedLines:
8383
def test_load_env_returns_path(self):
8484
"""Test that _load_env returns the loaded path"""
8585
from libs.base.application_base import ApplicationBase
86-
import os
86+
8787

8888
class TestApp(ApplicationBase):
8989
def initialize(self):
@@ -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

0 commit comments

Comments
 (0)