forked from xlwings/xlwings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.py
55 lines (41 loc) · 1.8 KB
/
runtests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Run this file on Windows only. It expects full Python installations with all dependencies in the paths below.
# On Mac, run the tests with tox.
from __future__ import print_function
import os
import inspect
from subprocess import call
from xlwings import __version__
# Python installations
py26 = r'C:\Python26'
py27 = r'C:\Python27'
py31 = r'C:\Python31' # numpy/pandas are missing for 3.1
py32 = r'C:\Python32'
py33 = r'C:\Python33'
py34 = r'C:\Python34'
class Colors:
# Only has an effect in the Terminal of PyCharm
yellow = '\033[93m'
end = '\033[0m'
this_dir = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
setup_file = os.path.abspath(os.path.join(this_dir, 'setup.py'))
# Create distribution package
call('python {0} sdist'.format(setup_file))
# Install it, run the tests and uninstall it for each Python version
for py in [py26, py27, py31, py32, py33, py34]:
# Paths
pip = os.path.abspath(os.path.join(py, 'Scripts/pip'))
test_runner = os.path.abspath(os.path.join(py, 'Scripts/nosetests'))
test_dir = os.path.abspath(os.path.join(py, 'Lib/site-packages/xlwings/tests'))
xlwings_package = os.path.abspath(os.path.join(this_dir, 'dist/xlwings-{0}.zip'.format(__version__)))
print('{0}### {1} ###{2}'.format(Colors.yellow, py, Colors.end))
call('{0}\python -c "import sys;print(sys.version)"'.format(py))
call('{0}\python -c "import numpy;import pandas;print(numpy.__version__);print(pandas.__version__)"'.format(py))
# Uninstall in case there is still an existing installation
call('{0} uninstall xlwings -y'.format(pip))
# Install
os.chdir(py)
call('{0} install {1}'.format(pip, xlwings_package))
# Run tests
call('{0} {1}'.format(test_runner, test_dir))
# Uninstall
call('{0} uninstall xlwings -y'.format(pip))