Skip to content

Commit d12005c

Browse files
Ryan P Kilbycarltongibson
authored andcommitted
Add 'dist' build (#5656)
1 parent 2359d39 commit d12005c

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

.travis.yml

Lines changed: 10 additions & 1 deletion
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-
- python: "2.7"
25+
26+
- python: "3.6"
27+
env: TOXENV=dist
28+
script:
29+
- python setup.py bdist_wheel
30+
- tox --installpkg ./dist/djangorestframework-*.whl
31+
- tox # test sdist
32+
33+
- python: "3.6"
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: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
ISORT_ARGS = ['--recursive', '--check-only', '-o' 'uritemplate', '-p', 'tests', 'rest_framework', 'tests']
1818

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

2220
def exit_on_failure(ret, message=None):
2321
if ret:
@@ -84,6 +82,20 @@ def is_class(string):
8482
run_flake8 = False
8583
run_isort = False
8684

85+
try:
86+
# Remove the package root directory from `sys.path`, ensuring that rest_framework
87+
# is imported from the installed site packages. Used for testing the distribution
88+
sys.argv.remove('--no-pkgroot')
89+
except ValueError:
90+
pass
91+
else:
92+
sys.path.pop(0)
93+
94+
# import rest_framework before pytest re-adds the package root directory.
95+
import rest_framework
96+
package_dir = os.path.join(os.getcwd(), 'rest_framework')
97+
assert not rest_framework.__file__.startswith(package_dir)
98+
8799
if len(sys.argv) > 1:
88100
pytest_args = sys.argv[1:]
89101
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 {posargs} --no-pkgroot -rw
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy