# HG changeset patch # User Jeff Hammel # Date 1330655512 28800 # Node ID 83327bc715be5e1bfcbf15ef8e0f70b5fa1cd09e # Parent bb8d993376aa890855caed256100642b6360d7e7 make the virtualenv convenience method return more stuff diff -r bb8d993376aa -r 83327bc715be tests/test.py --- a/tests/test.py Thu Mar 01 18:15:34 2012 -0800 +++ b/tests/test.py Thu Mar 01 18:31:52 2012 -0800 @@ -21,11 +21,15 @@ def create_virtualenv(path): """create a virtualenv and return the path to the python interpreter therein""" virtualenv.create_environment(path) - for python in (('bin', 'python'), ('Scripts', 'python.exe')): - python = os.path.join(path, *python) - if os.path.exists(python): - return python - raise Exception("Python binary not found in %s" % path) + for scripts, ext in (('bin', ''), ('Scripts', '.exe')): + scripts = os.path.join(path, scripts) + if os.path.exists(scripts): + break + else: + raise Exception("bin/Scripts not found in %s" % path) + binaries = ['python', 'easy_install', 'pip'] + binaries = dict([(i, i + ext) for i in binaries]) + return type('virtualenv', (), binaries) def run_tests(raise_on_error=False, report_first=False): diff -r bb8d993376aa -r 83327bc715be tests/test_ttw.txt --- a/tests/test_ttw.txt Thu Mar 01 18:15:34 2012 -0800 +++ b/tests/test_ttw.txt Thu Mar 01 18:31:52 2012 -0800 @@ -5,6 +5,7 @@ The obligatory imports:: + >>> import os >>> import urllib2 >>> from simpypi.factory import factory @@ -33,6 +34,26 @@ >>> 'Simple Index' in contents True + +There should be no files to start out with:: + + >>> os.listdir(directory) + [] + +Upload a file:: + + >>> path = os.path.join(here, 'HelloWorld-0.0.tar.gz') + >>> upload = MultiPartForm() + >>> upload.add_file('package', path) + >>> response = upload.post(url) + +Let's see if its in the right place:: + + >>> os.listdir(directory) + ['HelloWorld'] + >>> os.listdir(os.path.join(directory, 'HelloWorld')) + ['HelloWorld-0.0.tar.gz'] + Shut down the server:: >>> server.stop() diff -r bb8d993376aa -r 83327bc715be tests/test_wsgi.txt --- a/tests/test_wsgi.txt Thu Mar 01 18:15:34 2012 -0800 +++ b/tests/test_wsgi.txt Thu Mar 01 18:31:52 2012 -0800 @@ -69,7 +69,7 @@ Install the package and inspect the installation:: - >>> python = create_virtualenv(tmpdir) + >>> python = create_virtualenv(tmpdir).python You should not be able to import ``helloworld`` yet::