Skip to content

Commit

Permalink
Merge c12b47a into 302dd1f
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayub-Khan committed Mar 31, 2020
2 parents 302dd1f + c12b47a commit ba39299
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 20 deletions.
4 changes: 0 additions & 4 deletions .pep8

This file was deleted.

12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ language: python

cache: pip
python:
- 3.6
- 2.7
- 3.5
env:
- TOXENV=django111-drf37
- TOXENV=django111-drf38
Expand All @@ -12,8 +13,15 @@ env:

matrix:
include:
- python: 3.6
- python: 3.5
env: TOXENV=quality
- python: 3.5
env: TOXENV=django20-drflatest
- python: 3.5
env: TOXENV=django21-drflatest
- python: 3.5
env: TOXENV=django22-drflatest


# Set Travis builds to use docker container
sudo: false
Expand Down
2 changes: 1 addition & 1 deletion organizations/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
edx-organizations app initialization module
"""
__version__ = '4.0.0' # pragma: no cover
__version__ = '5.0.0' # pragma: no cover
3 changes: 2 additions & 1 deletion organizations/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def get_actions(self, request):
actions = super(OrganizationAdmin, self).get_actions(request)

# Remove the delete action.
del actions['delete_selected']
if 'delete_selected' in actions:
del actions['delete_selected']

return actions

Expand Down
9 changes: 6 additions & 3 deletions organizations/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
from __future__ import unicode_literals
from django.contrib.admin.sites import AdminSite
from django.contrib.messages.storage.fallback import FallbackStorage
from django.http import HttpRequest
from django.test import RequestFactory

import organizations.tests.utils as utils
from organizations.admin import OrganizationAdmin, OrganizationCourseAdmin
from organizations.models import Organization, OrganizationCourse
from organizations.tests.factories import UserFactory


def create_organization(active=True):
Expand All @@ -29,9 +30,11 @@ class OrganizationsAdminTestCase(utils.OrganizationsTestCaseBase):

def setUp(self):
super(OrganizationsAdminTestCase, self).setUp()
self.request = HttpRequest()
self.org_admin = OrganizationAdmin(Organization, AdminSite())
self.request = RequestFactory().get('/admin')
self.admin_user = UserFactory(is_staff=True)
self.request.session = 'session'
self.request.user = self.admin_user
self.request._messages = FallbackStorage(self.request) # pylint: disable=protected-access

def test_default_fields(self):
Expand Down Expand Up @@ -98,7 +101,7 @@ class OrganizationCourseAdminTestCase(utils.OrganizationsTestCaseBase):

def setUp(self):
super(OrganizationCourseAdminTestCase, self).setUp()
self.request = HttpRequest()
self.request = RequestFactory().get('')
self.org_course_admin = OrganizationCourseAdmin(OrganizationCourse, AdminSite())

def test_foreign_key_field_active_choices(self):
Expand Down
4 changes: 3 additions & 1 deletion requirements/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ edx-lint>=0.5.2,<1.0.0
factory-boy>=2.6.0,<3.0.0
httpretty>=0.8.14,<1.0.0
nose>=1.3.7,<2.0.0
pep8>=1.7.0,<2.0.0
pycodestyle
pytest-cov # pytest extension for code coverage statistics
pytest-django # pytest extension for better Django support
tox
11 changes: 11 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[pycodestyle]
ignore=E501
max_line_length=119
exclude=settings,migrations


[tool:pytest]
DJANGO_SETTINGS_MODULE = test_settings
python_files = tests.py test_*.py *_tests.py
addopts = --cov organizations --cov-report term-missing --cov-report xml
norecursedirs = .* requirements
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import organizations


def load_requirements(*requirements_paths):
"""
Load all requirements from the specified requirements files.
Expand Down Expand Up @@ -42,13 +43,14 @@ def is_requirement(line):
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0',
'Framework :: Django :: 2.1',
'Framework :: Django :: 2.2',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.5',
],
packages=find_packages(exclude=['tests']),
install_requires=load_requirements('requirements/base.in'),
Expand Down
8 changes: 8 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#
appdirs==1.4.3 # via virtualenv
astroid==1.5.3 # via edx-lint, pylint, pylint-celery
atomicwrites==1.3.0 # via pytest
attrs==19.3.0 # via pytest
backports.functools-lru-cache==1.6.1 # via astroid, isort, pylint
certifi==2019.11.28 # via -r requirements/base.txt, requests
chardet==3.0.4 # via -r requirements/base.txt, requests
Expand Down Expand Up @@ -39,6 +41,7 @@ ipaddress==1.0.23 # via faker
isort==4.3.21 # via pylint
lazy-object-proxy==1.4.3 # via astroid
mccabe==0.6.1 # via pylint
more-itertools==5.0.0 # via zipp
newrelic==5.10.0.138 # via -r requirements/base.txt, edx-django-utils
nose==1.3.7 # via -r requirements/test.in, django-nose
packaging==20.3 # via tox
Expand All @@ -49,13 +52,17 @@ pillow==6.2.2 # via -r requirements/base.txt
pluggy==0.13.1 # via tox
psutil==1.2.1 # via -r requirements/base.txt, edx-django-utils
py==1.8.1 # via tox
pycodestyle==2.5.0
pycryptodomex==3.9.7 # via -r requirements/base.txt, pyjwkest
pyjwkest==1.4.2 # via -r requirements/base.txt, edx-drf-extensions
pyjwt==1.7.1 # via -r requirements/base.txt, drf-jwt
pylint-celery==0.3 # via edx-lint
pylint-django==0.7.2 # via edx-lint
pylint-plugin-utils==0.6 # via pylint-celery, pylint-django
pylint==1.7.6 # via edx-lint, pylint-celery, pylint-django, pylint-plugin-utils
pytest-cov==2.8.1
pytest-django==3.6.0
pytest==4.6.6 # via pytest-cov, pytest-django
pymongo==3.10.1 # via -r requirements/base.txt, edx-opaque-keys
pyparsing==2.4.6 # via packaging
python-dateutil==2.8.1 # via -r requirements/base.txt, edx-drf-extensions, faker
Expand All @@ -73,5 +80,6 @@ tox==3.14.6 # via -r requirements/test.in
typing==3.7.4.1 # via importlib-resources
urllib3==1.25.8 # via -r requirements/base.txt, requests
virtualenv==20.0.15 # via tox
wcwidth==0.1.7 # via pytest
wrapt==1.12.1 # via astroid
zipp==1.2.0 # via importlib-metadata, importlib-resources
4 changes: 2 additions & 2 deletions test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
}

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
Expand All @@ -23,10 +24,9 @@
'django_nose',
)

MIDDLEWARE_CLASSES = (
MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)

Expand Down
10 changes: 5 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[tox]
envlist = py36-django111-drf{37,38,39,latest}, py36-django{20,21}-drf{latest}, quality
envlist = py{27,35}-django111-drf{39,latest}, py35-django{20,21,22}-drf{latest}, quality


[testenv]
setenv =
Expand All @@ -10,14 +11,13 @@ deps =
django111: Django>=1.11,<2.0
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
drf37: djangorestframework<3.8
drf38: djangorestframework<3.9
django22: Django>=2.2,<3.0
drf39: djangorestframework<4.0
drflatest: djangorestframework
-rtest-requirements.txt

commands =
django-admin.py test organizations --with-coverage --cover-package=organizations
python -Wd -m pytest {posargs}
coverage report

[testenv:quality]
Expand All @@ -26,5 +26,5 @@ deps =
djangorestframework<3.8
-rtest-requirements.txt
commands =
pep8 --config=.pep8 organizations
pycodestyle organizations
pylint --rcfile=pylintrc organizations

0 comments on commit ba39299

Please sign in to comment.