##// END OF EJS Templates
subprocess: Change all imports from `subprocess` -> `subprocess32`
Martin Bornhold -
r1007:e9c22488 default
parent child Browse files
Show More
@@ -35,7 +35,7 b" VERSION = (0, 5, 0, 'dev')"
35
35
36 import atexit
36 import atexit
37 import logging
37 import logging
38 import subprocess
38 import subprocess32
39 import time
39 import time
40 import urlparse
40 import urlparse
41 from cStringIO import StringIO
41 from cStringIO import StringIO
@@ -165,7 +165,7 b' def _start_pyro4_vcs_server(server_and_p'
165 '--threadpool', '32']
165 '--threadpool', '32']
166 if log_level:
166 if log_level:
167 args += ['--log-level', log_level]
167 args += ['--log-level', log_level]
168 proc = subprocess.Popen(args)
168 proc = subprocess32.Popen(args)
169
169
170 def cleanup_server_process():
170 def cleanup_server_process():
171 proc.kill()
171 proc.kill()
@@ -182,7 +182,7 b' def _start_http_vcs_server(server_and_po'
182 args = [
182 args = [
183 'pserve', 'rhodecode/tests/vcsserver_http.ini',
183 'pserve', 'rhodecode/tests/vcsserver_http.ini',
184 'http_port=%s' % (port, ), 'http_host=%s' % (host, )]
184 'http_port=%s' % (port, ), 'http_host=%s' % (host, )]
185 proc = subprocess.Popen(args)
185 proc = subprocess32.Popen(args)
186
186
187 def cleanup_server_process():
187 def cleanup_server_process():
188 proc.kill()
188 proc.kill()
@@ -15,7 +15,7 b' import logging'
15 import optparse
15 import optparse
16 import os
16 import os
17 import re
17 import re
18 import subprocess
18 import subprocess32
19 import sys
19 import sys
20 import textwrap
20 import textwrap
21 import threading
21 import threading
@@ -32,9 +32,9 b' from rhodecode.lib.compat import kill'
32
32
33
33
34 def make_web_build_callback(filename):
34 def make_web_build_callback(filename):
35 p = subprocess.Popen('make web-build', shell=True,
35 p = subprocess32.Popen('make web-build', shell=True,
36 stdout=subprocess.PIPE,
36 stdout=subprocess32.PIPE,
37 stderr=subprocess.PIPE,
37 stderr=subprocess32.PIPE,
38 cwd=os.path.dirname(os.path.dirname(__file__)))
38 cwd=os.path.dirname(os.path.dirname(__file__)))
39 stdout, stderr = p.communicate()
39 stdout, stderr = p.communicate()
40 stdout = ''.join(stdout)
40 stdout = ''.join(stdout)
@@ -658,7 +658,7 b' class RcServerCommand(object):'
658 try:
658 try:
659 try:
659 try:
660 _turn_sigterm_into_systemexit()
660 _turn_sigterm_into_systemexit()
661 proc = subprocess.Popen(args, env=new_environ)
661 proc = subprocess32.Popen(args, env=new_environ)
662 exit_code = proc.wait()
662 exit_code = proc.wait()
663 proc = None
663 proc = None
664 except KeyboardInterrupt:
664 except KeyboardInterrupt:
@@ -18,7 +18,7 b''
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 from subprocess import Popen, PIPE
21 from subprocess32 import Popen, PIPE
22 import os
22 import os
23 import shutil
23 import shutil
24 import sys
24 import sys
@@ -24,7 +24,7 b' Checking the chunked data transfer via H'
24
24
25 import os
25 import os
26 import time
26 import time
27 import subprocess
27 import subprocess32
28
28
29 import pytest
29 import pytest
30 import requests
30 import requests
@@ -53,7 +53,7 b' def echo_app_chunking(request, available'
53 'rhodecode.tests.lib.middleware.utils.test_scm_app_http_chunking'
53 'rhodecode.tests.lib.middleware.utils.test_scm_app_http_chunking'
54 ':create_echo_app')
54 ':create_echo_app')
55 command = command.format(port=port)
55 command = command.format(port=port)
56 proc = subprocess.Popen(command.split(' '), bufsize=0)
56 proc = subprocess32.Popen(command.split(' '), bufsize=0)
57 echo_app_url = 'http://localhost:' + str(port)
57 echo_app_url = 'http://localhost:' + str(port)
58
58
59 @request.addfinalizer
59 @request.addfinalizer
@@ -78,7 +78,7 b' def scm_app(request, available_port_fact'
78 command = command.format(port=port)
78 command = command.format(port=port)
79 env = os.environ.copy()
79 env = os.environ.copy()
80 env["RC_ECHO_URL"] = echo_app_chunking
80 env["RC_ECHO_URL"] = echo_app_chunking
81 proc = subprocess.Popen(command.split(' '), bufsize=0, env=env)
81 proc = subprocess32.Popen(command.split(' '), bufsize=0, env=env)
82 scm_app_url = 'http://localhost:' + str(port)
82 scm_app_url = 'http://localhost:' + str(port)
83 wait_for_url(scm_app_url)
83 wait_for_url(scm_app_url)
84
84
@@ -32,7 +32,7 b' import itertools'
32 import os
32 import os
33 import pprint
33 import pprint
34 import shutil
34 import shutil
35 import subprocess
35 import subprocess32
36 import sys
36 import sys
37 import time
37 import time
38
38
@@ -77,12 +77,12 b' def execute(*popenargs, **kwargs):'
77 input = kwargs.pop('stdin', None)
77 input = kwargs.pop('stdin', None)
78 stdin = None
78 stdin = None
79 if input:
79 if input:
80 stdin = subprocess.PIPE
80 stdin = subprocess32.PIPE
81 #if 'stderr' not in kwargs:
81 #if 'stderr' not in kwargs:
82 # kwargs['stderr'] = subprocess.PIPE
82 # kwargs['stderr'] = subprocess32.PIPE
83 if 'stdout' in kwargs:
83 if 'stdout' in kwargs:
84 raise ValueError('stdout argument not allowed, it will be overridden.')
84 raise ValueError('stdout argument not allowed, it will be overridden.')
85 process = subprocess.Popen(stdin=stdin, stdout=subprocess.PIPE,
85 process = subprocess32.Popen(stdin=stdin, stdout=subprocess32.PIPE,
86 *popenargs, **kwargs)
86 *popenargs, **kwargs)
87 output, error = process.communicate(input=input)
87 output, error = process.communicate(input=input)
88 retcode = process.poll()
88 retcode = process.poll()
@@ -91,7 +91,7 b' def execute(*popenargs, **kwargs):'
91 if cmd is None:
91 if cmd is None:
92 cmd = popenargs[0]
92 cmd = popenargs[0]
93 print cmd, output, error
93 print cmd, output, error
94 raise subprocess.CalledProcessError(retcode, cmd, output=output)
94 raise subprocess32.CalledProcessError(retcode, cmd, output=output)
95 return output
95 return output
96
96
97
97
@@ -31,7 +31,7 b' To stop the script by press Ctrl-C'
31 import datetime
31 import datetime
32 import os
32 import os
33 import psutil
33 import psutil
34 import subprocess
34 import subprocess32
35 import sys
35 import sys
36 import time
36 import time
37 import traceback
37 import traceback
@@ -66,7 +66,7 b' def dump_system():'
66
66
67
67
68 def count_dulwich_fds(proc):
68 def count_dulwich_fds(proc):
69 p = subprocess.Popen(["lsof", "-p", proc.pid], stdout=subprocess.PIPE)
69 p = subprocess32.Popen(["lsof", "-p", proc.pid], stdout=subprocess32.PIPE)
70 out, err = p.communicate()
70 out, err = p.communicate()
71
71
72 count = 0
72 count = 0
@@ -117,7 +117,7 b' print "VCS - Ok"'
117
117
118 print "\nStarting RhodeCode..."
118 print "\nStarting RhodeCode..."
119 rc = psutil.Popen("RC_VCSSERVER_TEST_DISABLE=1 paster serve test.ini",
119 rc = psutil.Popen("RC_VCSSERVER_TEST_DISABLE=1 paster serve test.ini",
120 shell=True, stdin=subprocess.PIPE)
120 shell=True, stdin=subprocess32.PIPE)
121 time.sleep(1)
121 time.sleep(1)
122 if not rc.is_running():
122 if not rc.is_running():
123 print "RC - Failed to start"
123 print "RC - Failed to start"
@@ -40,7 +40,7 b' import functools'
40 import logging
40 import logging
41 import os
41 import os
42 import shutil
42 import shutil
43 import subprocess
43 import subprocess32
44 import tempfile
44 import tempfile
45 import time
45 import time
46 from itertools import chain
46 from itertools import chain
@@ -145,8 +145,8 b' class Repository(object):'
145
145
146 def _run(self, *args):
146 def _run(self, *args):
147 command = [self.BASE_COMMAND] + list(args)
147 command = [self.BASE_COMMAND] + list(args)
148 process = subprocess.Popen(
148 process = subprocess32.Popen(
149 command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
149 command, stdout=subprocess32.PIPE, stderr=subprocess32.PIPE)
150 return process.communicate()
150 return process.communicate()
151
151
152 def _create_file(self, name, size):
152 def _create_file(self, name, size):
@@ -28,7 +28,7 b' Base for test suite for making push/pull'
28 """
28 """
29
29
30 from os.path import join as jn
30 from os.path import join as jn
31 from subprocess import Popen, PIPE
31 from subprocess32 import Popen, PIPE
32 import logging
32 import logging
33 import os
33 import os
34 import tempfile
34 import tempfile
@@ -29,7 +29,7 b' py.test config for test suite for making'
29
29
30 import ConfigParser
30 import ConfigParser
31 import os
31 import os
32 import subprocess
32 import subprocess32
33 import tempfile
33 import tempfile
34 import textwrap
34 import textwrap
35 import pytest
35 import pytest
@@ -164,7 +164,7 b' def rc_web_server('
164 print('Command: {}'.format(command))
164 print('Command: {}'.format(command))
165 print('Logfile: {}'.format(RC_LOG))
165 print('Logfile: {}'.format(RC_LOG))
166
166
167 proc = subprocess.Popen(
167 proc = subprocess32.Popen(
168 command, bufsize=0, env=env, stdout=server_out, stderr=server_out)
168 command, bufsize=0, env=env, stdout=server_out, stderr=server_out)
169
169
170 wait_for_url(host_url, timeout=30)
170 wait_for_url(host_url, timeout=30)
@@ -26,7 +26,7 b' import re'
26 import pprint
26 import pprint
27 import shutil
27 import shutil
28 import socket
28 import socket
29 import subprocess
29 import subprocess32
30 import time
30 import time
31 import uuid
31 import uuid
32
32
@@ -42,7 +42,7 b' from rhodecode.model.changeset_status im'
42 from rhodecode.model.comment import ChangesetCommentsModel
42 from rhodecode.model.comment import ChangesetCommentsModel
43 from rhodecode.model.db import (
43 from rhodecode.model.db import (
44 PullRequest, Repository, RhodeCodeSetting, ChangesetStatus, RepoGroup,
44 PullRequest, Repository, RhodeCodeSetting, ChangesetStatus, RepoGroup,
45 UserGroup, RepoRhodeCodeUi, RepoRhodeCodeSetting, RhodeCodeUi, Integration)
45 UserGroup, RepoRhodeCodeUi, RepoRhodeCodeSetting, RhodeCodeUi)
46 from rhodecode.model.meta import Session
46 from rhodecode.model.meta import Session
47 from rhodecode.model.pull_request import PullRequestModel
47 from rhodecode.model.pull_request import PullRequestModel
48 from rhodecode.model.repo import RepoModel
48 from rhodecode.model.repo import RepoModel
@@ -884,7 +884,7 b' class RepoServer(object):'
884 if vcsrepo.alias != 'svn':
884 if vcsrepo.alias != 'svn':
885 raise TypeError("Backend %s not supported" % vcsrepo.alias)
885 raise TypeError("Backend %s not supported" % vcsrepo.alias)
886
886
887 proc = subprocess.Popen(
887 proc = subprocess32.Popen(
888 ['svnserve', '-d', '--foreground', '--listen-host', 'localhost',
888 ['svnserve', '-d', '--foreground', '--listen-host', 'localhost',
889 '--root', vcsrepo.path])
889 '--root', vcsrepo.path])
890 self._cleanup_servers.append(proc)
890 self._cleanup_servers.append(proc)
@@ -23,7 +23,7 b' import logging.config'
23 import os
23 import os
24 import platform
24 import platform
25 import socket
25 import socket
26 import subprocess
26 import subprocess32
27 import time
27 import time
28 from urllib2 import urlopen, URLError
28 from urllib2 import urlopen, URLError
29
29
@@ -196,7 +196,7 b' class VCSServer(object):'
196
196
197 def start(self):
197 def start(self):
198 print("Starting the VCSServer: {}".format(self._args))
198 print("Starting the VCSServer: {}".format(self._args))
199 self.process = subprocess.Popen(self._args)
199 self.process = subprocess32.Popen(self._args)
200
200
201 def wait_until_ready(self, timeout=30):
201 def wait_until_ready(self, timeout=30):
202 raise NotImplementedError()
202 raise NotImplementedError()
@@ -255,7 +255,7 b' class HttpVCSServer(VCSServer):'
255 return template.format(**self._config)
255 return template.format(**self._config)
256
256
257 def start(self):
257 def start(self):
258 self.process = subprocess.Popen(self._args)
258 self.process = subprocess32.Popen(self._args)
259
259
260 def wait_until_ready(self, timeout=30):
260 def wait_until_ready(self, timeout=30):
261 host = self._config['host']
261 host = self._config['host']
@@ -30,10 +30,8 b' from os.path import join as jn'
30 from os.path import dirname as dn
30 from os.path import dirname as dn
31
31
32 from tempfile import _RandomNameSequence
32 from tempfile import _RandomNameSequence
33 from subprocess import Popen, PIPE
33 from subprocess32 import Popen, PIPE
34
35 from paste.deploy import appconfig
34 from paste.deploy import appconfig
36 from pylons import config
37
35
38 from rhodecode.lib.utils import add_cache
36 from rhodecode.lib.utils import add_cache
39 from rhodecode.lib.utils2 import engine_from_config
37 from rhodecode.lib.utils2 import engine_from_config
@@ -42,7 +40,7 b' from rhodecode.model import init_model'
42 from rhodecode.model import meta
40 from rhodecode.model import meta
43 from rhodecode.model.db import User, Repository
41 from rhodecode.model.db import User, Repository
44
42
45 from rhodecode.tests import TESTS_TMP_PATH, NEW_HG_REPO, HG_REPO
43 from rhodecode.tests import TESTS_TMP_PATH, HG_REPO
46 from rhodecode.config.environment import load_environment
44 from rhodecode.config.environment import load_environment
47
45
48 rel_path = dn(dn(dn(dn(os.path.abspath(__file__)))))
46 rel_path = dn(dn(dn(dn(os.path.abspath(__file__)))))
@@ -22,7 +22,7 b' import threading'
22 import time
22 import time
23 import logging
23 import logging
24 import os.path
24 import os.path
25 import subprocess
25 import subprocess32
26 import urllib2
26 import urllib2
27 from urlparse import urlparse, parse_qsl
27 from urlparse import urlparse, parse_qsl
28 from urllib import unquote_plus
28 from urllib import unquote_plus
@@ -113,10 +113,10 b' def _load_svn_dump_into_repo(dump_name, '
113 integrated with the main repository once they stabilize more.
113 integrated with the main repository once they stabilize more.
114 """
114 """
115 dump = rc_testdata.load_svn_dump(dump_name)
115 dump = rc_testdata.load_svn_dump(dump_name)
116 load_dump = subprocess.Popen(
116 load_dump = subprocess32.Popen(
117 ['svnadmin', 'load', repo_path],
117 ['svnadmin', 'load', repo_path],
118 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
118 stdin=subprocess32.PIPE, stdout=subprocess32.PIPE,
119 stderr=subprocess.PIPE)
119 stderr=subprocess32.PIPE)
120 out, err = load_dump.communicate(dump)
120 out, err = load_dump.communicate(dump)
121 if load_dump.returncode != 0:
121 if load_dump.returncode != 0:
122 log.error("Output of load_dump command: %s", out)
122 log.error("Output of load_dump command: %s", out)
@@ -20,7 +20,7 b''
20
20
21 import datetime
21 import datetime
22 import os
22 import os
23 import subprocess
23 import subprocess32
24
24
25 import pytest
25 import pytest
26
26
@@ -86,8 +86,8 b' class TestGetScm:'
86 def test_get_two_scms_for_path(self, tmpdir):
86 def test_get_two_scms_for_path(self, tmpdir):
87 multialias_repo_path = str(tmpdir)
87 multialias_repo_path = str(tmpdir)
88
88
89 subprocess.check_call(['hg', 'init', multialias_repo_path])
89 subprocess32.check_call(['hg', 'init', multialias_repo_path])
90 subprocess.check_call(['git', 'init', multialias_repo_path])
90 subprocess32.check_call(['git', 'init', multialias_repo_path])
91
91
92 with pytest.raises(VCSError):
92 with pytest.raises(VCSError):
93 get_scm(multialias_repo_path)
93 get_scm(multialias_repo_path)
@@ -27,7 +27,7 b' import os'
27 import re
27 import re
28 import sys
28 import sys
29
29
30 from subprocess import Popen
30 from subprocess32 import Popen
31
31
32
32
33 class VCSTestError(Exception):
33 class VCSTestError(Exception):
General Comments 0
You need to be logged in to leave comments. Login now