Skip to content

Commit

Permalink
Merge pull request #101 from edx/BOM-1030-django22-support
Browse files Browse the repository at this point in the history
Django22 Support
  • Loading branch information
Ayub-Khan authored Nov 28, 2019
2 parents 0caca6c + bafe49a commit 1a5c001
Show file tree
Hide file tree
Showing 43 changed files with 838 additions and 179 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ submissions_test_db
docs/_build/

venvs

# Requirements tmp file
test.txt.tmp
66 changes: 55 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,69 @@
language: python
dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069)
dist: latest

python:
- 2.7
- 3.6
- 3.7
- 3.5

env:
- TOXENV=django111
- TOXENV=django20
- TOXENV=django21
- TOXENV=django111-drf37
- TOXENV=django111-drf38
- TOXENV=django111-drf39
- TOXENV=django111-drflatest
- TOXENV=django20-drf37
- TOXENV=django20-drf38
- TOXENV=django20-drf39
- TOXENV=django20-drflatest
- TOXENV=django21-drf37
- TOXENV=django21-drf38
- TOXENV=django21-drf39
- TOXENV=django21-drflatest
- TOXENV=django22-drf37
- TOXENV=django22-drf38
- TOXENV=django22-drf39
- TOXENV=django22-drflatest

matrix:
include:
- python: 3.5
env: TOXENV=quality
- python: 3.5
env: TOXENV=docs
exclude:
- python: 2.7
env: TOXENV=django20
env: TOXENV=django20-drf37
- python: 2.7
env: TOXENV=django21
env: TOXENV=django20-drf38
- python: 2.7
env: TOXENV=django20-drf39
- python: 2.7
env: TOXENV=django20-drflatest
- python: 2.7
env: TOXENV=django21-drf37
- python: 2.7
env: TOXENV=django21-drf38
- python: 2.7
env: TOXENV=django21-drf39
- python: 2.7
env: TOXENV=django21-drflatest
- python: 2.7
env: TOXENV=django22-drf37
- python: 2.7
env: TOXENV=django22-drf38
- python: 2.7
env: TOXENV=django22-drf39
- python: 2.7
env: TOXENV=django22-drflatest

install:
- pip install -r requirements.txt
- pip install -r test-requirements.txt
- pip install -r requirements/test.txt
- python setup.py install
- pip install coveralls
script:
- tox
after_success: coveralls
after_success:
- codecov

# Set password via "travis encrypt --add deploy.password"; for details, see
# https://docs.travis-ci.com/user/deployment/pypi
deploy:
Expand All @@ -33,3 +75,5 @@ deploy:
secure: BlYK3lplRoPiNfzqslxyReJZrC1QUT9Ls1A1xIxc3IHxKl9WEkqC2xO5vBvQDFKtMyooq8bGeN/gfksaZpRYqBmrO7hPITiz0FH0wPFdjoIikI4NTqKVxjhqUho0ZWmpxNXrX/iMd9Y2R4uZRXZGaWaTSRHfF9fPVlkbo66s7vw=
on:
tags: true
python: 3.5
condition: "$TOXENV = django111-drflatest"
6 changes: 0 additions & 6 deletions AUTHORS

This file was deleted.

7 changes: 3 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include requirements.txt
include test-requirements.txt
include django-requirements.txt
include requirements/base.in
include requirements/test.in
include requirements/docs.in
include LICENSE
include AUTHORS
include README.rst
66 changes: 66 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
.DEFAULT_GOAL := help

define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url

webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"

.PHONY: clean, coverage, diff_cover, docs, help, dev_requirements, test, test_quality, test_requirements, upgrade

help: ## Display this help message
@echo "Please use \`make <target>' where <target> is one of"
@awk -F ':.*?## ' '/^[a-zA-Z]/ && NF==2 {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort

clean: ## Remove generated byte code, coverage reports, and build artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
coverage erase
rm -fr build/
rm -fr dist/
rm -fr *.egg-info

docs: ## generate Sphinx HTML documentation
python setup.py build_sphinx

dev_requirements: ## Install Dev Requirements
pip install -r requirements/dev.txt

test_requirements: ## Install Test Requirements
pip install -r requirements/test.txt

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## Update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -qr requirements/pip-tools.txt
# Make sure to compile files after any other files they include!
pip-compile --upgrade --verbose --rebuild -o requirements/pip-tools.txt requirements/pip-tools.in
pip-compile --upgrade --verbose --rebuild -o requirements/base.txt requirements/base.in
pip-compile --upgrade --verbose --rebuild -o requirements/docs.txt requirements/docs.in
pip-compile --upgrade --verbose --rebuild -o requirements/test.txt requirements/test.in
pip-compile --upgrade --verbose --rebuild -o requirements/dev.txt requirements/dev.in
# Let tox control the Django and DRF versions for tests
sed -i.tmp '/^django==/d' requirements/test.txt
sed -i.tmp '/^djangorestframework==/d' requirements/test.txt
rm requirements/test.txt.tmp

test: clean ## Run tests in the current virtualenv
pytest

coverage: clean ## Generate and view HTML coverage report
py.test --cov-report html
$(BROWSER) htmlcov/index.html

diff_cover: test ## Generate diff coverage report
diff-cover coverage.xml

test_quality: ## Run Quality checks
pylint submissions
isort --check-only --recursive submissions manage.py setup.py settings.py
pycodestyle . --config=pycodestyle
8 changes: 3 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ To run the test suite:

.. code:: bash
pip install -r test-requirements.txt
tox # to run only a single environment, do e.g. tox -e django18
make test_requirements
tox # to run only a single environment, do e.g. tox -e py35-django22-drf39
To use a Django shell to test commands:

.. code:: bash
pip install -r django-requirements.txt
pip install -r requirements.txt
pip install -r test-requirements.txt
make dev_requirements
./manage.py migrate
./manage.py shell --settings=settings
>>> from submissions.serializers import StudentItemSerializer
Expand Down
1 change: 0 additions & 1 deletion django-requirements.txt

This file was deleted.

3 changes: 0 additions & 3 deletions pycodestyle

This file was deleted.

Loading

0 comments on commit 1a5c001

Please sign in to comment.