Dave Abrahams avatar Dave Abrahams committed 1e1b7a1

Clean up detritus after testing to keep VCSes from seeing spurious new/changed files. Use a more responsive website for nose's index so we don't have to wait forever for tests. Improved progress messages.

Comments (0)

Files changed (1)

tests/auto_test.py

 def assert_in_path(exe):
     system(exe, '--version')
 
+def clean(root):
+    print >> sys.stderr, 'Cleaning ...',
+    for dirpath, dirnames, filenames in os.walk(root):
+        for f in filenames:
+            if f.endswith('.pyc'):
+                os.unlink(Path(dirpath)/f)
+    rmtree(root/'build')
+    rmtree(root/'dist')
+    rmtree(root/'pip.egg-info')
+    rmtree(root/'tests'/'test-scratch')
+    rmtree(root/'tests'/'test-cache')
+    try: os.unlink(root/'tests'/'packages'/'FSPkg'/'FSPkg.egg-info'/'PKG-INFO')
+    except: pass
+    print >> sys.stderr, 'ok'
+
+
 def main(argv):
     here = Path(sys.path[0])
     script_name = Path(__file__).name
     #
     # Delete everything that could lead to stale test results
     #
-    print >> sys.stderr, 'Cleaning ...',
-    for dirpath, dirnames, filenames in os.walk(pip_root):
-        for f in filenames:
-            if f.endswith('.pyc'):
-                os.unlink(Path(dirpath)/f)
-    rmtree(pip_root/'build')
-    rmtree(pip_root/'dist')
-    print >> sys.stderr, 'ok'
+    clean( pip_root )
     
     save_dir = os.getcwd()
     temp_dir = mkdtemp('-pip_auto_test')
         #
         # Prepare a clean, writable workspace
         #
-        print >> sys.stderr, 'Preparing test environment ...',
+        print >> sys.stderr, 'Preparing test environment ...'
         venv, lib, include, bin = create_virtualenv(temp_dir)
 
         abs_bin = Path(bin).abspath
         pip = abs_bin/'pip'+exe
         download_cache = '--download-cache=' \
             + Path(gettempdir())/'pip-test-download-cache'
-        call(pip, 'install', '-q', download_cache, 'virtualenv')
-        call(pip, 'install', '-q', download_cache, 'nose')
-        # for now, we need a pre-release version of scripttest
-        call(pip, 'install', '-q', download_cache, 'scripttest')
+        def pip_install(*pkg):
+            print >> sys.stderr, '   pip install',' '.join(pkg), '...',
+            call(pip, 'install', '-q', download_cache, *pkg)
+            print >> sys.stderr, 'ok'
+        pip_install('virtualenv')
+        pip_install('--no-index', '-f', 'http://pypi.python.org/packages/source/n/nose/', 'nose')
+        pip_install('scripttest>=1.0.4')
         print >> sys.stderr, 'ok'
         nosetests = abs_bin/'nosetests'+exe
         call( nosetests, '-w', pip_root/'tests', *argv[1:] )
     finally:
         os.chdir(save_dir)
         rmtree(temp_dir)
+        # Keep VCSes from seeing spurious new/changed files
+        clean(pip_root)
 
 
 if __name__ == '__main__':
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.