Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses pylint version 4.0.4 compliance issues for the azure-appconfiguration and azure-appconfiguration-provider packages as part of issue #44708. The changes focus on fixing linting warnings without altering functionality.
Changes:
- Reordered imports to follow consistent pattern: stdlib, third-party, local modules, azure packages
- Added pylint disable comments for classes with many public methods
- Refactored test code to use setup methods instead of inline context managers
- Converted instance methods to static methods where appropriate
- Removed unused imports and parameters
- Fixed missing return statement in sample utility function
Reviewed changes
Copilot reviewed 55 out of 56 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| test_query_param_policy.py | Reordered imports, removed unused return statement, attempted to split long lines with multi-line strings (introduces bugs) |
| test_consistency.py | Reordered imports |
| test_azure_appconfiguration_client_async.py | Reordered imports, added pylint disable, refactored context manager usage, attempted error message line splitting (introduces bugs), added staticmethod decorator |
| test_azure_appconfiguration_client_aad_async.py | Reordered imports, added pylint disable, attempted error message line splitting (introduces bugs), split long comment |
| test_azure_appconfiguration_client_aad.py | Reordered imports, added pylint disable, attempted error message line splitting (introduces bugs) |
| test_azure_appconfiguration_client.py | Reordered imports, added pylint disable, removed unused imports, refactored context manager usage, attempted error message line splitting (introduces bugs), fixed SecretReferenceConfigurationSetting test, added staticmethod decorator |
| test_audience_policy.py | Reordered imports |
| test_audience_error_handling_live_async.py | Reordered imports, removed unused imports |
| test_audience_error_handling_live.py | Reordered imports, removed unused imports |
| preparers.py (azure-appconfiguration) | Reordered imports, attempted connection string line splitting (introduces bugs) |
| perfstress_tests/set.py | Removed unused import |
| perfstress_tests/get.py | Removed unused import |
| asynctestcase.py | Reordered imports |
| snapshot_sample_async.py | Reordered imports, split long docstring |
| snapshot_sample.py | Reordered imports, split long docstring |
| hello_world_sample_entra_id_and_bleu.py | Split long docstring, changed environment variable name (introduces documentation inconsistency) |
| hello_world_entra_id_sample.py | Changed environment variable name (introduces documentation inconsistency) |
| conditional_operation_sample.py | Fixed early return pattern |
| testcase.py (azure-appconfiguration-provider) | Reordered imports |
| test_tag_filters.py | Reordered imports, removed unused import |
| test_snapshots.py | Removed unused import |
| test_request_tracing_context.py | Added pylint disable comment (missing space) |
| test_provider_refresh.py | Reordered imports |
| test_provider_feature_management.py | Reordered imports |
| test_provider_aad.py | Reordered imports |
| test_provider.py | Reordered imports, removed unused parameter |
| test_json.py | Minor whitespace fix in test string |
| test_discovery.py | Reordered imports |
| test_configuration_client_manager_load_balance.py | Reordered imports |
| test_configuration_client_manager.py | Reordered imports |
| key_vault/test_secret_refresh.py | Reordered imports |
| key_vault/test_secret_provider.py | Reordered imports |
| aio/test_configuration_async_client_manager_load_balance.py | Reordered imports |
| aio/test_configuration_async_client_manager.py | Reordered imports, split long patch decorator paths |
| aio/test_async_snapshots.py | Removed unused import |
| aio/test_async_provider_refresh.py | Reordered imports |
| aio/test_async_provider_feature_management.py | Reordered imports |
| aio/test_async_provider_aad.py | Reordered imports |
| aio/test_async_provider.py | Reordered imports, split long comment |
| aio/test_async_discovery.py | Reordered imports, removed unused import |
| aio/key_vault/test_async_secret_refresh.py | Reordered imports, removed unused import |
| aio/key_vault/test_async_secret_provider.py | Reordered imports |
| samples/snapshot_sample.py (provider) | Removed unused import |
| samples/sample_utilities.py | Added missing return statement |
| samples/refresh_sample_feature_flags.py | Reordered imports, changed unused parameter to underscore, split long comment |
| samples/refresh_sample.py | Reordered imports, changed unused parameter to underscore, split long comment |
| samples/key_vault_reference_sample.py | Reordered imports |
| samples/key_vault_reference_customized_clients_sample.py | Reordered imports |
| samples/connection_string_sample.py | Reordered imports |
| samples/async_snapshot_sample.py | Reordered imports |
| samples/async_key_vault_reference_sample.py | Reordered imports |
| samples/async_key_vault_reference_provided_clients_sample.py | Reordered imports |
| samples/async_connection_string_sample.py | Reordered imports |
| samples/async_aad_sample.py | Reordered imports |
| samples/aad_sample.py | Reordered imports |
| 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. | ||
| """ | ||
| import os | ||
| from azure.appconfiguration import AzureAppConfigurationClient | ||
| from azure.identity import DefaultAzureCredential | ||
| from azure.appconfiguration import ConfigurationSetting | ||
|
|
||
|
|
||
| def main(): | ||
| # [START create_app_config_client] | ||
|
|
||
| ENDPOINT = os.environ["APPCONFIGURATION_ENDPOINT"] | ||
| ENDPOINT = os.environ["APPCONFIGURATION_ENDPOINT_STRING"] |
There was a problem hiding this comment.
The documentation comment at line 18 states the environment variable should be 'APPCONFIGURATION_CONNECTION_STRING', but this sample actually uses Entra ID authentication (not connection string) and requires 'APPCONFIGURATION_ENDPOINT_STRING' as seen in line 29. The documentation is misleading and should be updated to reflect the actual environment variable requirements.
| expected_url = """ | ||
| ?%24filter=startsWith%28key%2C%27app%27%29&%24select=key%2Cvalue&%24top=10&api-version=2023-10-01&label=prod&maxitems=100 | ||
| """ |
There was a problem hiding this comment.
The multi-line string format used here will include leading and trailing whitespace/newlines in the string value, which will cause the assertion to fail. The expected_url should not include newlines and indentation as these will be part of the actual string value. The original single-line format was correct.
| # cspell:disable-line | ||
| original_url = """ | ||
| ?$select=key,value&tags=feature%3Dauth&label=*&api-version=2023-11-01&$filter=startsWith(key,'app')&tags=env%3Dtest | ||
| """ | ||
|
|
||
| expected_url = """ | ||
| ?%24filter=startsWith%28key%2C%27app%27%29&%24select=key%2Cvalue&api-version=2023-11-01&label=%2A&tags=feature%3Dauth&tags=env%3Dtest | ||
| """ |
There was a problem hiding this comment.
The multi-line string format used here will include leading and trailing whitespace/newlines in the string values, which will cause the test to fail. The strings should not include newlines and indentation as these will be part of the actual string value when using triple-quoted strings. The original single-line format with inline comments was correct.
| == """ | ||
| AzureAppConfigurationClient.list_configuration_settings() got multiple values for argument 'label_filter' | ||
| """ |
There was a problem hiding this comment.
The multi-line string format used here will include leading and trailing whitespace/newlines in the string value, which will cause the assertion to fail. When comparing error messages, the extra whitespace will cause the comparison to fail. The original single-line format was correct.
| == """ | ||
| AzureAppConfigurationClient.list_configuration_settings() got multiple values for argument 'label_filter' | ||
| """ |
There was a problem hiding this comment.
The multi-line string format used here will include leading and trailing whitespace/newlines in the string value, which will cause the assertion to fail. When comparing error messages, the extra whitespace will cause the comparison to fail. The original single-line format was correct.
| == """ | ||
| AzureAppConfigurationClient.list_configuration_settings() got multiple values for argument 'label_filter' | ||
| """ |
There was a problem hiding this comment.
The multi-line string format used here will include leading and trailing whitespace/newlines in the string value, which will cause the assertion to fail. When comparing error messages, the extra whitespace will cause the comparison to fail. The original single-line format was correct.
| == """ | ||
| AzureAppConfigurationClient.list_configuration_settings() got multiple values for argument 'label_filter' | ||
| """ |
There was a problem hiding this comment.
The multi-line string format used here will include leading and trailing whitespace/newlines in the string value, which will cause the assertion to fail. When comparing error messages, the extra whitespace will cause the comparison to fail. The original single-line format was correct.
| == """ | ||
| AzureAppConfigurationClient.list_configuration_settings() got multiple values for argument 'label_filter' | ||
| """ |
There was a problem hiding this comment.
The multi-line string format used here will include leading and trailing whitespace/newlines in the string value, which will cause the assertion to fail. When comparing error messages, the extra whitespace will cause the comparison to fail. The original single-line format was correct.
| == """ | ||
| AzureAppConfigurationClient.list_configuration_settings() got multiple values for argument 'label_filter' | ||
| """ |
There was a problem hiding this comment.
The multi-line string format used here will include leading and trailing whitespace/newlines in the string value, which will cause the assertion to fail. When comparing error messages, the extra whitespace will cause the comparison to fail. The original single-line format was correct.
| appconfiguration_connection_string=""" | ||
| Endpoint=https://fake_app_config.azconfig-test.io;Id=0-l4-s0:h5htBaY5Z1LwFz50bIQv;Secret=lamefakesecretlamefakesecretlamefakesecrett= | ||
| """, |
There was a problem hiding this comment.
The multi-line string format used here will include leading and trailing whitespace/newlines in the connection string value. This will cause the preparer to use an incorrect connection string that includes newlines and indentation, leading to test failures. The original single-line format was correct.
Description
Part 1 of updates for #44708, a second PR needs to be created to update the sanitation steps.
Note: Only samples/tests have been modified as part of this change.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines