Merge ~pappacena/turnip:popen-close-streams into turnip:master

Proposed by Thiago F. Pappacena
Status: Merged
Approved by: Thiago F. Pappacena
Approved revision: 3b62235512002eee37edf8944084e7f1da42008d
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~pappacena/turnip:popen-close-streams
Merge into: turnip:master
Diff against target: 30 lines (+5/-4)
1 file modified
turnip/api/tests/test_helpers.py (+5/-4)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+383914@code.launchpad.net

Commit message

Closing Popen std streams to avoid warnings on python3

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Needs Fixing
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

Pushed the requested changes, cjwatson.

Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/turnip/api/tests/test_helpers.py b/turnip/api/tests/test_helpers.py
2index a6035b4..d1a288c 100644
3--- a/turnip/api/tests/test_helpers.py
4+++ b/turnip/api/tests/test_helpers.py
5@@ -6,7 +6,7 @@ import fnmatch
6 import itertools
7 import logging
8 import os
9-from subprocess import PIPE, Popen, CalledProcessError
10+from subprocess import PIPE, Popen, CalledProcessError, STDOUT
11 import uuid
12
13 from pygit2 import (
14@@ -112,12 +112,13 @@ class RepoFactory(object):
15 cmd_line = ['git', '-C', self.repo_path]
16 cmd_line += self._get_cmd_line_auth_params()
17 cmd_line += ['tag', '-m', tag_message, tag_name, oid.hex]
18- subproc = Popen(cmd_line, stderr=PIPE, stdout=PIPE)
19- retcode = subproc.wait()
20+ subproc = Popen(cmd_line, stdout=PIPE, stderr=STDOUT)
21+ out, err = subproc.communicate()
22+ retcode = subproc.returncode
23 if retcode:
24 log.error(
25 "Command %s finished with error code %s. stdout/stderr:\n%s",
26- cmd_line, retcode, subproc.stderr.read())
27+ cmd_line, retcode, out)
28 raise CalledProcessError(retcode, cmd_line)
29
30 def makeSignature(self, name, email, encoding='utf-8'):

Subscribers

People subscribed via source and target branches