Skip to content

Commit c9cd3ea

Browse files
[fix] restore original test order in test_pr.py to maintain clean git history
1 parent dfcde1a commit c9cd3ea

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

tests/comfy_cli/command/github/test_pr.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,28 @@ def test_fetch_pr_info_success(self, mock_get, sample_pr_info):
9494
assert result.head_branch == "load-3d-nodes"
9595
assert result.mergeable is True
9696

97+
@patch("requests.get")
98+
def test_fetch_pr_info_not_found(self, mock_get):
99+
"""Test PR not found (404)"""
100+
mock_response = Mock()
101+
mock_response.status_code = 404
102+
mock_response.raise_for_status.side_effect = requests.HTTPError("404 Not Found")
103+
mock_get.return_value = mock_response
104+
105+
with pytest.raises(Exception, match="Failed to fetch PR"):
106+
fetch_pr_info("comfyanonymous", "ComfyUI", 999)
107+
108+
@patch("requests.get")
109+
def test_fetch_pr_info_rate_limit(self, mock_get):
110+
"""Test GitHub API rate limit handling"""
111+
mock_response = Mock()
112+
mock_response.status_code = 403
113+
mock_response.headers = {"x-ratelimit-remaining": "0"}
114+
mock_get.return_value = mock_response
115+
116+
with pytest.raises(Exception, match="Primary rate limit from Github exceeded!"):
117+
fetch_pr_info("comfyanonymous", "ComfyUI", 123)
118+
97119
@patch("requests.get")
98120
def test_find_pr_by_branch_success(self, mock_get):
99121
"""Test successful PR search by branch"""
@@ -140,28 +162,6 @@ def test_find_pr_by_branch_error(self, mock_get):
140162
result = find_pr_by_branch("comfyanonymous", "ComfyUI", "testuser", "test-branch")
141163
assert result is None
142164

143-
@patch("requests.get")
144-
def test_fetch_pr_info_not_found(self, mock_get):
145-
"""Test PR not found (404)"""
146-
mock_response = Mock()
147-
mock_response.status_code = 404
148-
mock_response.raise_for_status.side_effect = requests.HTTPError("404 Not Found")
149-
mock_get.return_value = mock_response
150-
151-
with pytest.raises(Exception, match="Failed to fetch PR"):
152-
fetch_pr_info("comfyanonymous", "ComfyUI", 999)
153-
154-
@patch("requests.get")
155-
def test_fetch_pr_info_rate_limit(self, mock_get):
156-
"""Test GitHub API rate limit handling"""
157-
mock_response = Mock()
158-
mock_response.status_code = 403
159-
mock_response.headers = {"x-ratelimit-remaining": "0"}
160-
mock_get.return_value = mock_response
161-
162-
with pytest.raises(Exception, match="Primary rate limit from Github exceeded!"):
163-
fetch_pr_info("comfyanonymous", "ComfyUI", 123)
164-
165165

166166
class TestGitOperations:
167167
"""Test Git operations for PR checkout"""

0 commit comments

Comments
 (0)