Skip to content

Commit

Permalink
Catch non-clean exits of arc call-conduit
Browse files Browse the repository at this point in the history
  • Loading branch information
albertyw committed Jan 3, 2021
1 parent dc59aeb commit 3ac9dc3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions git_reviewers/reviewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def check_phabricator_activated(self, username: str) -> subprocess.Popen:
def parse_phabricator(self, username, process):
# type: (str, subprocess.Popen) -> str
stdout, stderr = process.communicate()
if process.returncode != 0:
print("stdout: %s" % stdout)
print("stderr: %s" % stderr)
raise RuntimeError("Arc not able to call conduit")
output_str = stdout.decode("utf-8").strip()
phab_output = json.loads(output_str)
data = phab_output['response']['data']
Expand Down
3 changes: 3 additions & 0 deletions git_reviewers/tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def test_verbose_reviewers(self, mock_print):
with patch(get_reviewers) as mock_get_reviewers:
with patch(run_command) as mock_run_command:
with patch('subprocess.Popen') as mock_popen:
mock_popen().returncode = 0
mock_popen().communicate.return_value = \
[PHAB_ACTIVATED_DATA, b'']
mock_run_command.return_value = []
Expand Down Expand Up @@ -311,6 +312,7 @@ def test_ignore_reviewers(self, mock_print):
with patch(get_reviewers) as mock_get_reviewers:
with patch(run_command) as mock_run_command:
with patch('subprocess.Popen') as mock_popen:
mock_popen().returncode = 0
mock_popen().communicate.return_value = \
[PHAB_ACTIVATED_DATA, b'']
mock_run_command.return_value = []
Expand All @@ -330,6 +332,7 @@ def test_phabricator_disabled_reviewers(self, mock_print):
with patch(get_reviewers) as mock_get_reviewers:
with patch(run_command) as mock_run_command:
with patch('subprocess.Popen') as mock_popen:
mock_popen().returncode = 0
mock_popen().communicate.return_value = \
[PHAB_DISABLED_DATA, b'']
mock_run_command.return_value = []
Expand Down

0 comments on commit 3ac9dc3

Please sign in to comment.