Skip to content

Commit c4f363c

Browse files
committed
Add some testing automation
1 parent 10d2e3e commit c4f363c

7 files changed

+95
-7
lines changed

.coveragerc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[run]
2+
branch = True
3+
include =
4+
s3transfer/*

.travis.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
language: python
2+
python:
3+
- "2.6"
4+
- "2.7"
5+
- "3.3"
6+
- "3.4"
7+
- "3.5"
8+
sudo: false
9+
install:
10+
- python scripts/ci/install
11+
script: python scripts/ci/run-tests

requirements-text.txt

-7
This file was deleted.

scripts/ci/install

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
from subprocess import check_call
5+
import shutil
6+
7+
_dname = os.path.dirname
8+
9+
REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))
10+
os.chdir(REPO_ROOT)
11+
12+
13+
def run(command):
14+
return check_call(command, shell=True)
15+
16+
17+
try:
18+
# Has the form "major.minor"
19+
python_version = os.environ['PYTHON_VERSION']
20+
except KeyError:
21+
python_version = '.'.join([str(i) for i in sys.version_info[:2]])
22+
23+
run('pip install -r requirements-test.txt')
24+
run('pip install coverage')
25+
if os.path.isdir('dist') and os.listdir('dist'):
26+
shutil.rmtree('dist')
27+
run('python setup.py bdist_wheel')
28+
wheel_dist = os.listdir('dist')[0]
29+
run('pip install %s' % (os.path.join('dist', wheel_dist)))

scripts/ci/run-integ-tests

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python
2+
# Don't run tests from the root repo dir.
3+
# We want to ensure we're importing from the installed
4+
# binary package not from the CWD.
5+
6+
import os
7+
from subprocess import check_call
8+
9+
_dname = os.path.dirname
10+
11+
REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))
12+
os.chdir(os.path.join(REPO_ROOT, 'tests'))
13+
14+
15+
def run(command):
16+
return check_call(command, shell=True)
17+
18+
19+
run('nosetests --with-xunit --cover-erase --with-coverage '
20+
'--cover-package s3transfer --cover-xml -v integration')

scripts/ci/run-tests

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python
2+
# Don't run tests from the root repo dir.
3+
# We want to ensure we're importing from the installed
4+
# binary package not from the CWD.
5+
6+
import os
7+
from subprocess import check_call
8+
9+
_dname = os.path.dirname
10+
11+
REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))
12+
os.chdir(os.path.join(REPO_ROOT, 'tests'))
13+
14+
15+
def run(command):
16+
return check_call(command, shell=True)
17+
18+
19+
run('nosetests --with-coverage --cover-erase --cover-package s3transfer '
20+
'--with-xunit --cover-xml -v unit/')

tox.ini

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[tox]
2+
envlist = py26,py27,py33,py34,py35
3+
4+
# Comment to build sdist and install into virtualenv
5+
# This is helpful to test installation but takes extra time
6+
skipsdist = True
7+
8+
[testenv]
9+
commands =
10+
{toxinidir}/scripts/ci/install
11+
{toxinidir}/scripts/ci/run-tests

0 commit comments

Comments
 (0)