]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
qa: Remove unnecessary global statements in tests
authorKefu Chai <tchaikov@gmail.com>
Sun, 30 Mar 2025 03:48:28 +0000 (11:48 +0800)
committerCasey Bodley <cbodley@redhat.com>
Tue, 1 Apr 2025 15:15:01 +0000 (11:15 -0400)
commita696e3bc35ee5a32bf028b196a010bae2a401dde
tree0ff564850da23ab2826d49a54071097020a4edeb
parent4fc56063c232ba1bc00c45c1ba8b33e65553c1a2
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 <tchaikov@gmail.com>
(cherry picked from commit bcc275f98cb26c9432c320cd24ee93ff629e0574)
qa/tasks/radosgw_admin.py
qa/workunits/dencoder/test_readable.py