summaryrefslogtreecommitdiff
path: root/setuptools/tests/test_windows_wrappers.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-01-01 11:13:58 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-01-01 11:13:58 -0500
commit88b8ad6b797cb9dcd898fc1b125dc90cc35c565f (patch)
tree54d90e6a31bfe7070b5178aed1d091e3657bc280 /setuptools/tests/test_windows_wrappers.py
parentf43351575a3f92cd5422973a03c577f787c5898c (diff)
downloadpython-setuptools-git-88b8ad6b797cb9dcd898fc1b125dc90cc35c565f.tar.gz
Extract prep_script method
Diffstat (limited to 'setuptools/tests/test_windows_wrappers.py')
-rw-r--r--setuptools/tests/test_windows_wrappers.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/setuptools/tests/test_windows_wrappers.py b/setuptools/tests/test_windows_wrappers.py
index 0e165bd9..187177f7 100644
--- a/setuptools/tests/test_windows_wrappers.py
+++ b/setuptools/tests/test_windows_wrappers.py
@@ -26,6 +26,12 @@ pytestmark = pytest.mark.skipif(sys.platform != 'win32', reason="Windows only")
class WrapperTester:
+
+ @classmethod
+ def prep_script(cls, template):
+ python_exe = nt_quote_arg(sys.executable)
+ return template % locals()
+
@classmethod
def create_script(cls, tempdir):
"""
@@ -37,8 +43,7 @@ class WrapperTester:
"""
sample_directory = tempdir
- python_exe = nt_quote_arg(sys.executable)
- script = cls.script_tmpl % locals()
+ script = cls.prep_script(cls.script_tmpl)
with open(os.path.join(sample_directory, cls.script_name), 'w') as f:
f.write(script)
@@ -124,7 +129,7 @@ class TestCLI(WrapperTester):
sys.ps1 = '---'
""").lstrip()
with open(os.path.join(sample_directory, 'foo-script.py'), 'w') as f:
- f.write(tmpl % dict(python_exe=nt_quote_arg(sys.executable)))
+ f.write(self.prep_script(tmpl))
cmd = [os.path.join(sample_directory, 'foo.exe')]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout, stderr = proc.communicate()