diff options
| author | Chris McDonough <chrism@plope.com> | 2011-01-30 18:26:01 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-01-30 18:26:01 -0500 |
| commit | eb0079afa437b51f9f8df5a8c96a89182b88a075 (patch) | |
| tree | ffe5850e523491cab85dba40d01600b56f954a42 /template_tests.py | |
| parent | 89335fd705ac7e179c243c1758294c605600a781 (diff) | |
| download | pyramid-eb0079afa437b51f9f8df5a8c96a89182b88a075.tar.gz pyramid-eb0079afa437b51f9f8df5a8c96a89182b88a075.tar.bz2 pyramid-eb0079afa437b51f9f8df5a8c96a89182b88a075.zip | |
make function on 2.4 and 2.5
Diffstat (limited to 'template_tests.py')
| -rw-r--r-- | template_tests.py | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/template_tests.py b/template_tests.py index a6fba2639..8e70e7eb3 100644 --- a/template_tests.py +++ b/template_tests.py @@ -1,3 +1,4 @@ +import sys import httplib import os import pkg_resources @@ -5,6 +6,15 @@ import shutil import subprocess import tempfile import time +import signal + +if not hasattr(subprocess, 'check_call'): + # 2.4 + def check_call(*arg, **kw): + returncode = subprocess.call(*arg, **kw) + if returncode: + raise ValueError(returncode) + subprocess.check_call = check_call class TemplateTest(object): def make_venv(self, directory): @@ -47,14 +57,23 @@ class TemplateTest(object): resp = conn.getresponse() assert(resp.status == 200) finally: - proc.terminate() + if hasattr(proc, 'terminate'): + # 2.6+ + proc.terminate() + else: + # 2.5 + os.kill(proc.pid, signal.SIGTERM) finally: shutil.rmtree(self.directory) os.chdir(self.old_cwd) +templates = ['pyramid_starter', 'pyramid_alchemy', 'pyramid_routesalchemy',] + +if sys.version_info >= (2, 5): + templates.append('pyramid_zodb') + if __name__ == '__main__': - for name in ('pyramid_starter', 'pyramid_alchemy', 'pyramid_routesalchemy', - 'pyramid_zodb'): + for name in templates: test = TemplateTest() test.install(name) |
