Skip to content

Add 'dist' build #5656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@ matrix:
- { python: "3.6", env: DJANGO=2.0 }
- { python: "2.7", env: TOXENV=lint }
- { python: "2.7", env: TOXENV=docs }
- python: "2.7"

- python: "3.6"
env: TOXENV=dist
script:
- python setup.py bdist_wheel
- tox --installpkg ./dist/djangorestframework-*.whl
- tox # test sdist

- python: "3.6"
env: TOXENV=readme
addons:
apt_packages: pandoc

exclude:
- { python: "2.7", env: DJANGO=master }
- { python: "2.7", env: DJANGO=2.0 }
Expand Down
16 changes: 14 additions & 2 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

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

sys.path.append(os.path.dirname(__file__))


def exit_on_failure(ret, message=None):
if ret:
Expand Down Expand Up @@ -84,6 +82,20 @@ def is_class(string):
run_flake8 = False
run_isort = False

try:
# Remove the package root directory from `sys.path`, ensuring that rest_framework
# is imported from the installed site packages. Used for testing the distribution
sys.argv.remove('--no-pkgroot')
except ValueError:
pass
else:
sys.path.pop(0)

# import rest_framework before pytest re-adds the package root directory.
import rest_framework
package_dir = os.path.join(os.getcwd(), 'rest_framework')
assert not rest_framework.__file__.startswith(package_dir)

if len(sys.argv) > 1:
pytest_args = sys.argv[1:]
first_arg = pytest_args[0]
Expand Down
10 changes: 9 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ envlist =
{py27,py34,py35,py36}-django111,
{py34,py35,py36}-django20,
{py35,py36}-djangomaster,
lint,docs,readme,
dist,lint,docs,readme,

[travis:env]
DJANGO =
Expand All @@ -18,6 +18,7 @@ DJANGO =

[testenv]
commands = ./runtests.py --fast {posargs} --coverage -rw
envdir = {toxworkdir}/venvs/{envname}
setenv =
PYTHONDONTWRITEBYTECODE=1
PYTHONWARNINGS=once
Expand All @@ -29,6 +30,13 @@ deps =
-rrequirements/requirements-testing.txt
-rrequirements/requirements-optionals.txt

[testenv:dist]
commands = ./runtests.py --fast {posargs} --no-pkgroot -rw
deps =
django
-rrequirements/requirements-testing.txt
-rrequirements/requirements-optionals.txt

[testenv:lint]
basepython = python2.7
commands = ./runtests.py --lintonly
Expand Down