]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Add a script for setting up a windows VM for testing.
authorBen Darnell <ben@bendarnell.com>
Sun, 3 Feb 2013 03:40:53 +0000 (22:40 -0500)
committerBen Darnell <ben@bendarnell.com>
Sun, 3 Feb 2013 03:40:53 +0000 (22:40 -0500)
This works with the images provided by http://modern.ie.

maint/vm/windows/bootstrap.py [new file with mode: 0644]
maint/vm/windows/tox.ini [new file with mode: 0644]

diff --git a/maint/vm/windows/bootstrap.py b/maint/vm/windows/bootstrap.py
new file mode 100644 (file)
index 0000000..669981c
--- /dev/null
@@ -0,0 +1,87 @@
+r"""Installs files needed for tornado testing on windows.
+
+These instructions are compatible with the VMs provided by http://modern.ie.
+The bootstrapping script works on the WinXP/IE6 and Win8/IE10 configurations,
+although tornado's tests do not pass on XP.
+
+1) Install virtualbox guest additions (from the device menu in virtualbox)
+2) Set up a shared folder to the root of your tornado repo.  It must be a
+   read-write mount to use tox, although the tests can be run directly
+   in a read-only mount.  This will probably assign drive letter E:.
+3) Install Python 2.7 from python.org.
+4) Run this script by double-clicking it, or running
+   "c:\python27\python.exe bootstrap.py" in a shell.
+
+To run the tests by hand, cd to e:\ and run
+  c:\python27\python.exe -m tornado.test.runtests
+To run the tests with tox, cd to e:\maint\vm\windows and run
+  c:\python27\scripts\tox
+To run under cygwin (which must be installed separately), run
+  cd /cygdrive/e; python -m tornado.test.runtests
+"""
+
+import os
+import subprocess
+import sys
+import urllib
+
+TMPDIR = r'c:\tornado_bootstrap'
+
+PYTHON_VERSIONS = [
+    (r'c:\python26\python.exe', 'http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi'),
+    (r'c:\python27\python.exe', 'http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi'),
+    (r'c:\python32\python.exe', 'http://www.python.org/ftp/python/3.2.3/python-3.2.3.msi'),
+    (r'c:\python33\python.exe', 'http://www.python.org/ftp/python/3.3.0/python-3.3.0.msi'),
+    ]
+
+SCRIPTS_DIR = r'c:\python27\scripts'
+EASY_INSTALL = os.path.join(SCRIPTS_DIR, 'easy_install.exe')
+
+PY_PACKAGES = ['tox', 'virtualenv', 'pip']
+
+def download_to_cache(url, local_name=None):
+    if local_name is None:
+        local_name = url.split('/')[-1]
+    filename = os.path.join(TMPDIR, local_name)
+    if not os.path.exists(filename):
+        data = urllib.urlopen(url).read()
+        with open(filename, 'wb') as f:
+            f.write(data)
+    return filename
+
+def main():
+    if not os.path.exists(TMPDIR):
+        os.mkdir(TMPDIR)
+    os.chdir(TMPDIR)
+    for exe, url in PYTHON_VERSIONS:
+        if os.path.exists(exe):
+            print "%s already exists, skipping" % exe
+            continue
+        print "Installing %s" % url
+        filename = download_to_cache(url)
+        # http://blog.jaraco.com/2012/01/how-i-install-python-on-windows.html
+        subprocess.check_call(['msiexec', '/i', filename,
+                               'ALLUSERS=1', '/passive'])
+
+    if not os.path.exists(EASY_INSTALL):
+        filename = download_to_cache('http://python-distribute.org/distribute_setup.py')
+        subprocess.check_call([sys.executable, filename])
+
+    subprocess.check_call([EASY_INSTALL] + PY_PACKAGES)
+
+    # cygwin's setup.exe doesn't like being run from a script (looks
+    # UAC-related).  If it did, something like this might install it.
+    # (install python, python-setuptools, python3, and easy_install
+    # unittest2 (cygwin's python 2 is 2.6))
+    #filename = download_to_cache('http://cygwin.com/setup.exe')
+    #CYGTMPDIR = os.path.join(TMPDIR, 'cygwin')
+    #if not os.path.exists(CYGTMPDIR):
+    #    os.mkdir(CYGTMPDIR)
+    ## http://www.jbmurphy.com/2011/06/16/powershell-script-to-install-cygwin/
+    #CYGWIN_ARGS = [filename, '-q', '-l', CYGTMPDIR,
+    #               '-s', 'http://mirror.nyi.net/cygwin/', '-R', r'c:\cygwin']
+    #subprocess.check_call(CYGWIN_ARGS)
+
+
+if __name__ == '__main__':
+    main()
diff --git a/maint/vm/windows/tox.ini b/maint/vm/windows/tox.ini
new file mode 100644 (file)
index 0000000..ec7c571
--- /dev/null
@@ -0,0 +1,43 @@
+[tox]
+envlist = py27-full, py32-full, py26, py26-full, py27, py32, py33, py27-opt, py33-monotonic
+setupdir = e:\
+toxworkdir = c:\tox-tornado
+
+[testenv]
+commands = python -m tornado.test.runtests {posargs:}
+
+[testenv:py26]
+deps = unittest2
+
+[testenv:py26-full]
+basepython = python2.6
+deps =
+     futures
+     mock
+     unittest2
+
+[testenv:py27-full]
+basepython = python2.7
+deps =
+     futures
+     mock
+
+[testenv:py32-full]
+basepython = python3.2
+deps =
+     mock
+
+[testenv:py33]
+# tox's path mappings haven't been updated for py33 yet.
+basepython = c:\python33\python.exe
+
+[testenv:py33-monotonic]
+basepython = c:\python33\python.exe
+commands = python -m tornado.test.runtests --ioloop_time_monotonic {posargs:}
+
+[testenv:py27-opt]
+basepython = python2.7
+deps =
+     futures
+     mock
+commands = python -O -m tornado.test.runtests {posargs:}