File: run_pyversion_tests.py

package info (click to toggle)
python-tornado 2.3-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,536 kB
  • sloc: python: 12,755; ansic: 64; xml: 26; sql: 25; makefile: 17
file content (40 lines) | stat: -rwxr-xr-x 1,032 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
"""Runs the tornado test suite with all supported python interpreters."""

from __future__ import absolute_import, division, with_statement

import os
import subprocess
import sys

INTERPRETERS = [
    "python2.5",
    "python2.6",
    "python2.7",
    "auto2to3",
    "pypy",
    ]


def exists_on_path(filename):
    for dir in os.environ["PATH"].split(":"):
        if os.path.exists(os.path.join(dir, filename)):
            return True
    return False


def main():
    for interpreter in INTERPRETERS:
        print "=================== %s =======================" % interpreter
        if not exists_on_path(interpreter):
            print "Interpreter not found, skipping..."
            continue
        args = [interpreter, "-m", "tornado.test.runtests"] + sys.argv[1:]
        ret = subprocess.call(args)
        if ret != 0:
            print "Tests on %s failed with exit code %d" % (interpreter, ret)
            sys.exit(ret)
    print "All tests passed"

if __name__ == "__main__":
    main()