Skip to content

Commit

Permalink
Fix various errors reported by gh codescan
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Verga <mattia.verga@tiscali.it>
  • Loading branch information
mattiaverga committed Nov 9, 2024
1 parent 05eca06 commit f07e238
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bodhi-server/bodhi/server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3117,7 +3117,7 @@ def set_request(self, db, action, username):
LockedUpdateException: If the update is locked.
"""
log.debug('Attempting to set request %s' % action)
log.debug(f'Attempting to set request {action}')
notes = []
if isinstance(action, str):
action = UpdateRequest.from_string(action)
Expand Down
4 changes: 2 additions & 2 deletions bodhi-server/bodhi/server/tasks/composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1506,8 +1506,8 @@ def _generate_module_list(self):
for update in self.compose.updates:
# We need to get the Koji builds also for the updates.
koji.multicall = True
for update in self.compose.updates:
for build in update.builds:
for updt in self.compose.updates:
for build in updt.builds:
koji.getBuild(build.nvr)
results = koji.multiCall()
for result, build in zip(results, update.builds):
Expand Down
12 changes: 4 additions & 8 deletions bodhi-server/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,10 @@ def test___iter__(self):
{'testing': ('testing', 'Testing'), 'stable': ('stable', 'Stable')})
expected_values = ['testing', 'stable']

for v in iter(m):
assert repr(v) == '<{}>'.format(expected_values.pop(0))
for v, e in zip(iter(m), expected_values):
assert repr(v) == f'<{e}>'
assert type(v) is model.EnumSymbol # noqa: E721

assert expected_values == []


class TestEnumSymbol:
"""Test the EnumSymbol class."""
Expand All @@ -456,10 +454,8 @@ def test___iter__(self):
s = model.EnumSymbol(model.UpdateStatus, 'name', 'value', 'description')
expected_values = ['value', 'description']

for v in iter(s):
assert v == expected_values.pop(0)

assert expected_values == []
for v, e in zip(iter(s), expected_values):
assert v == e

def test___json__(self):
"""Ensure that the __json__() method returns the value."""
Expand Down
3 changes: 1 addition & 2 deletions devel/ci/integration/tests/test_bodhi.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ def test_get_releases_view(bodhi_container, db_container):
with conn:
with conn.cursor() as curs:
curs.execute(query)
for record in curs:
expected_releases = [r[0] for r in curs]
expected_releases = [r[0] for r in curs]
conn.close()

# GET on /releases
Expand Down

0 comments on commit f07e238

Please sign in to comment.