]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Encourage "python -m tornado.test.runtests" as the way to run the tests.
authorBen Darnell <ben@bendarnell.com>
Mon, 25 Jun 2012 01:41:11 +0000 (18:41 -0700)
committerBen Darnell <ben@bendarnell.com>
Mon, 25 Jun 2012 01:45:27 +0000 (18:45 -0700)
Remove execute bit from tornado/test/runtests.py, which would unexpectedly
run the tests from a globally-installed version of tornado when run directly.
Add a new runtests.sh to make the recommended behavior more discoverable.
Remove run_pyversion_tests.py, which has been superceded by tox.
Update docs.

Closes #545.

MANIFEST.in
runtests.sh [new file with mode: 0755]
tornado/test/run_pyversion_tests.py [deleted file]
tornado/test/runtests.py [changed mode: 0755->0644]
tornado/testing.py

index 5b28bd64470bc8d0a7fd37b47f2f95474801d49b..ff3a1f86c17e73888c06ddc21f753d026c3706d4 100644 (file)
@@ -9,4 +9,5 @@ include tornado/test/gettext_translations/fr_FR/LC_MESSAGES/tornado_test.mo
 include tornado/test/gettext_translations/fr_FR/LC_MESSAGES/tornado_test.po
 include tornado/test/static/robots.txt
 include tornado/test/templates/utf8.html
+include runtests.sh
 global-exclude _auto2to3*
\ No newline at end of file
diff --git a/runtests.sh b/runtests.sh
new file mode 100755 (executable)
index 0000000..07bd360
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cd $(dirname $0)
+
+# "python -m" differs from "python tornado/test/runtests.py" in how it sets
+# up the default python path.  "python -m" uses the current directory,
+# while "python file.py" uses the directory containing "file.py" (which is
+# not what you want if file.py appears within a package you want to import
+# from)
+python -m tornado.test.runtests "$@"
diff --git a/tornado/test/run_pyversion_tests.py b/tornado/test/run_pyversion_tests.py
deleted file mode 100755 (executable)
index 1680645..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/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()
old mode 100755 (executable)
new mode 100644 (file)
index e809123e03aad8cfe4e1e2c764a7ba6f505e3293..83a7e03373a5314437e7eb40cec26641827bc644 100644 (file)
@@ -388,9 +388,9 @@ def main():
     be overridden by naming a single test on the command line::
 
         # Runs all tests
-        tornado/test/runtests.py
+        python -m tornado.test.runtests
         # Runs one test
-        tornado/test/runtests.py tornado.test.stack_context_test
+        python -m tornado.test.runtests tornado.test.stack_context_test
 
     """
     from tornado.options import define, options, parse_command_line