Skip to content

Commit eec51f6

Browse files
author
Ryan P Kilby
committed
Add 'dist' build
1 parent 7855d3b commit eec51f6

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,19 @@ matrix:
2222
- { python: "3.6", env: DJANGO=2.0 }
2323
- { python: "2.7", env: TOXENV=lint }
2424
- { python: "2.7", env: TOXENV=docs }
25+
26+
- python: "3.6"
27+
env: TOXENV=dist
28+
script:
29+
- python setup.py bdist_wheel
30+
- tox
31+
- tox --installpkg ./dist/djangorestframework-*.whl
32+
2533
- python: "2.7"
2634
env: TOXENV=readme
2735
addons:
2836
apt_packages: pandoc
37+
2938
exclude:
3039
- { python: "2.7", env: DJANGO=master }
3140
- { python: "2.7", env: DJANGO=2.0 }

runtests.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#! /usr/bin/env python
22
from __future__ import print_function
33

4-
import os
54
import subprocess
65
import sys
76

@@ -16,8 +15,6 @@
1615

1716
ISORT_ARGS = ['--recursive', '--check-only', '-o' 'uritemplate', '-p', 'tests', 'rest_framework', 'tests']
1817

19-
sys.path.append(os.path.dirname(__file__))
20-
2118

2219
def exit_on_failure(ret, message=None):
2320
if ret:
@@ -84,6 +81,15 @@ def is_class(string):
8481
run_flake8 = False
8582
run_isort = False
8683

84+
try:
85+
# Remove the project directory from `sys.path`. This is used to ensure that
86+
# local files do not conflict with an installed distribution during testing.
87+
sys.argv.remove('--remove-path')
88+
except ValueError:
89+
pass
90+
else:
91+
sys.path.pop(0)
92+
8793
if len(sys.argv) > 1:
8894
pytest_args = sys.argv[1:]
8995
first_arg = pytest_args[0]

tox.ini

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ envlist =
77
{py27,py34,py35,py36}-django111,
88
{py34,py35,py36}-django20,
99
{py35,py36}-djangomaster,
10-
lint,docs,readme,
10+
dist,lint,docs,readme,
1111

1212
[travis:env]
1313
DJANGO =
@@ -18,6 +18,7 @@ DJANGO =
1818

1919
[testenv]
2020
commands = ./runtests.py --fast {posargs} --coverage -rw
21+
envdir = {toxworkdir}/venvs/{envname}
2122
setenv =
2223
PYTHONDONTWRITEBYTECODE=1
2324
PYTHONWARNINGS=once
@@ -29,6 +30,13 @@ deps =
2930
-rrequirements/requirements-testing.txt
3031
-rrequirements/requirements-optionals.txt
3132

33+
[testenv:dist]
34+
commands = ./runtests.py --fast --remove-path {posargs}
35+
deps =
36+
django
37+
-rrequirements/requirements-testing.txt
38+
-rrequirements/requirements-optionals.txt
39+
3240
[testenv:lint]
3341
basepython = python2.7
3442
commands = ./runtests.py --lintonly

0 commit comments

Comments
 (0)