Skip to content

Commit bcc275f

Browse files
committed
qa: Remove unnecessary global statements in tests
Removes unused `global` statements from Python test files to fix flake8 F824 errors. Recent flake8 runs were failing with: ``` ./tasks/radosgw_admin.py:330:5: F824 `global log` is unused: name is never assigned in scope ./workunits/dencoder/test_readable.py:99:5: F824 `global incompat_paths` is unused: name is never assigned in scope ./workunits/dencoder/test_readable.py:164:5: F824 `global backward_compat` is unused: name is never assigned in scope ./workunits/dencoder/test_readable.py:165:5: F824 `global fast_shouldnt_skip` is unused: name is never assigned in scope ``` Since these variables are only being referenced and not assigned within their scopes, the `global` declarations are unnecessary and can be safely removed. This change: - Removes all flagged `global` statements - Fixes the failing flake8 checks in the CI pipeline - Maintains the original code behavior as variable references still work without the `global` keyword The `global` keyword is only needed when assigning to global variables within a function scope, not when simply referencing them. Signed-off-by: Kefu Chai <[email protected]>
1 parent 21f67af commit bcc275f

File tree

2 files changed

+0
-4
lines changed

2 files changed

+0
-4
lines changed

qa/tasks/radosgw_admin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ def task(ctx, config):
327327
"""
328328
Test radosgw-admin functionality against a running rgw instance.
329329
"""
330-
global log
331330

332331
assert ctx.rgw.config, \
333332
"radosgw_admin task needs a config passed from the rgw task"

qa/workunits/dencoder/test_readable.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ def process_type(file_path, type):
9696
return 0 # File passed the test
9797

9898
def test_object_wrapper(type, vdir, arversion, current_ver):
99-
global incompat_paths
10099
_numtests = 0
101100
_failed = 0
102101
unrecognized = ""
@@ -161,8 +160,6 @@ def should_skip_object(type, arversion, current_ver):
161160
Returns:
162161
bool: True if the object should be skipped, False otherwise.
163162
"""
164-
global backward_compat
165-
global fast_shouldnt_skip
166163

167164
# Validate global structures
168165
if not isinstance(backward_compat, dict) or not isinstance(fast_shouldnt_skip, list):

0 commit comments

Comments
 (0)