Skip to content

Commit 1b42840

Browse files
cfsmp3claude
andcommitted
fix: use MockStatus object instead of dict in test_webhook_pr_closed
The code in mod_ci/controllers.py:1785 expects status objects with a .context attribute, but the test was returning dictionaries. This worked in earlier Python versions but fails in Python 3.14. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 4fca3d7 commit 1b42840

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/test_ci/test_controllers.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ def __init__(self, platform):
3838
self.value = 'linux'
3939

4040

41+
class MockStatus:
42+
"""Mock GitHub commit status object."""
43+
44+
def __init__(self, context):
45+
self.context = context
46+
47+
4148
class MockFork:
4249
"""Mock fork object."""
4350

@@ -781,8 +788,10 @@ def __init__(self):
781788
self.commit = "test"
782789

783790
mock_test.query.filter.return_value.all.return_value = [MockTest()]
791+
# Use MockStatus object instead of dict - code expects .context attribute
792+
# Use 'linux' to match MockPlatform.value
784793
mock_repo.return_value.get_commit.return_value.get_statuses.return_value = [
785-
{"context": f"CI - {platform_name}"}]
794+
MockStatus("CI - linux")]
786795

787796
data = {'action': 'closed',
788797
'pull_request': {'number': 1234, 'draft': False}}

0 commit comments

Comments
 (0)