Source

distutils2 / run-all-tests.py

#!/usr/bin/env python
import shutil
import subprocess
import os

def get_python_3_lib_path():
	cmd = [
		'python3.2',
		'-c',
		"from distutils.util import get_platform; "
		"import sys; "
		"print('lib.%s-%s' % (get_platform(), sys.version[0:3]))"
		]
	return subprocess.check_output(cmd)

for python_ver in '2.4 2.5 2.6 2.7 3.1 3.2 3.3'.split():
	try:
		subprocess.check_call(['python'+python_ver, '-V'])
	except:
		print("Skipping tests for Python %s (not found)" % python_ver)
		continue
	print ("Running tests for Python %s" % python_ver)
	if python_ver == '2.4':
		try:
			os.remove('distutils2/_backport/_hashlib.so')
		except:
			pass
		cmd = [
			'python'+python_ver,
			'setup.py',
			'build_ext',
			'-f', '-q',
			]
		subprocess.check_call(cmd)
	wd = '.'
	env = dict(os.environ)
	if python_ver.startswith('3'):
		wd = 'build'
		
		env['PYTHONPATH'] = os.path.pathsep.join((
			get_python_3_lib_path(),
			'lib',))
			
	
	cmd = [
		'python'+python_ver,
		'runtests.py',
		'-q',
	]
	if python_ver.startswith('2'):
		cmd[1:1]  = ['-Wd']
	if python_ver == '2.7':
		cmd[1:1] = ['-bb', '-3']
	try:
		subprocess.check_call(cmd, env=env, cwd=wd)
	except:
		print("Failed")
		if python_ver == '2.4':
			os.remove('distutils2/_backport/_hashlib.so')
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.