Commit 25c44d52 by Brian Wilson

Upgrade Django.

* Add tox to test with Django 1.8 and 1.11
* Fix so travis can call tox.
* Switch to edx-lint.
* Add fixes for clean build of dist.
parent 10d80ab8
...@@ -8,6 +8,7 @@ local_settings.py ...@@ -8,6 +8,7 @@ local_settings.py
htmlcov htmlcov
.ropeproject .ropeproject
*.sublime-* *.sublime-*
.tox/
### Editor and IDE artifacts ### Editor and IDE artifacts
*~ *~
......
language: python language: python
python: python:
- "2.7" - 2.7
env:
- TOXENV=django18
- TOXENV=django111
install: install:
- make test.setup install - make test.setup install
script: script:
- make ci - tox
services: mongodb services: mongodb
include requirements.txt
include dev-requirements.txt
include LICENSE.TXT
include AUTHORS
include README.rst
mock coverage>=4.4.1,<5.0.0
nose django_nose>=1.4.4,<=2.0.0
coverage edx-lint>=0.5.4,<1.0.0
pep8 nose>=1.3.7,<2.0.0
pylint pep8>=1.7.0,<2.0.0
django-nose==1.4.1 tox>=2.7.0,<3.0.0
mock==2.0.0
sphinx==1.1.3 sphinx==1.1.3
...@@ -45,7 +45,7 @@ class LoggerBackend(object): ...@@ -45,7 +45,7 @@ class LoggerBackend(object):
class DateTimeJSONEncoder(json.JSONEncoder): class DateTimeJSONEncoder(json.JSONEncoder):
"""JSON encoder aware of datetime.datetime and datetime.date objects""" """JSON encoder aware of datetime.datetime and datetime.date objects"""
def default(self, obj): # pylint: disable=method-hidden def default(self, obj): # lint-amnesty, pylint: disable=arguments-differ, method-hidden
""" """
Serialize datetime and date objects of iso format. Serialize datetime and date objects of iso format.
......
...@@ -97,7 +97,7 @@ class RoutingBackend(object): ...@@ -97,7 +97,7 @@ class RoutingBackend(object):
Returns the modified event. Returns the modified event.
""" """
if len(self.processors) == 0: if len(self.processors) == 0: # lint-amnesty, pylint: disable=len-as-condition
return event return event
processed_event = event processed_event = event
......
...@@ -8,7 +8,7 @@ from contextlib import contextmanager ...@@ -8,7 +8,7 @@ from contextlib import contextmanager
import time import time
import os import os
import random import random
import string # pylint: disable=deprecated-module import string
class InMemoryBackend(object): class InMemoryBackend(object):
......
...@@ -108,7 +108,7 @@ class DjangoTracker(Tracker): ...@@ -108,7 +108,7 @@ class DjangoTracker(Tracker):
for key, value in node.iteritems(): for key, value in node.iteritems():
result[key] = self.instantiate_objects(value) result[key] = self.instantiate_objects(value)
elif isinstance(node, list): elif isinstance(node, list):
result = [] # pylint: disable=redefined-variable-type result = []
for child in node: for child in node:
result.append(self.instantiate_objects(child)) result.append(self.instantiate_objects(child))
......
...@@ -28,7 +28,7 @@ class TestTrack(TestCase): # pylint: disable=missing-docstring ...@@ -28,7 +28,7 @@ class TestTrack(TestCase): # pylint: disable=missing-docstring
self._datetime_patcher = patch('eventtracking.tracker.datetime') self._datetime_patcher = patch('eventtracking.tracker.datetime')
self.addCleanup(self._datetime_patcher.stop) self.addCleanup(self._datetime_patcher.stop)
mock_datetime = self._datetime_patcher.start() mock_datetime = self._datetime_patcher.start()
mock_datetime.now.return_value = self._expected_timestamp # pylint: disable=maybe-no-member mock_datetime.now.return_value = self._expected_timestamp
def configure_mock_backends(self, number_of_mocks): def configure_mock_backends(self, number_of_mocks):
"""Ensure the tracking module has the requisite number of mock backends""" """Ensure the tracking module has the requisite number of mock backends"""
......
Django >= 1.8, < 1.9 # Django is now defined explicitly in setup.py,
# so that tox can define it separately from
# how setup.py includes it.
pymongo>=2.7.2,<4.0.0 pymongo>=2.7.2,<4.0.0
pytz pytz
...@@ -2,29 +2,61 @@ import os ...@@ -2,29 +2,61 @@ import os
from setuptools import setup from setuptools import setup
from setuptools import find_packages from setuptools import find_packages
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
REQUIREMENTS = [line.strip() for line in
open("requirements.txt").readlines()]
# allow setup.py to be run from any path # allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
def is_requirement(line):
"""
Return True if the requirement line is a package requirement;
that is, it is not blank, a comment, or editable.
"""
# Remove whitespace at the start/end of the line
line = line.strip()
# Skip blank lines, comments, and editable installs
return not (
line == '' or
line.startswith('-r') or
line.startswith('#') or
line.startswith('-e') or
line.startswith('git+')
)
def load_requirements(*requirements_paths):
"""
Load all requirements from the specified requirements files.
Returns a list of requirement strings.
"""
requirements = set()
for path in requirements_paths:
requirements.update(
line.strip() for line in open(path).readlines()
if is_requirement(line)
)
return list(requirements)
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
REQUIREMENTS = load_requirements('requirements.txt')
REQUIREMENTS.append('Django>=1.8,<2')
setup( setup(
name='event-tracking', name='event-tracking',
version='0.2.2', version='0.2.3',
packages=find_packages(), packages=find_packages(),
include_package_data=True, include_package_data=True,
license='AGPLv3 License', license='AGPLv3 License',
description='A simple event tracking system.', description='A simple event tracking system.',
long_description=README, long_description=README,
install_requires=REQUIREMENTS, install_requires=REQUIREMENTS,
url='http://code.edx.org/', url='https://github.com/edx/event-tracking',
author='edX',
author_email='oscm@edx.org',
classifiers=[ classifiers=[
'Development Status :: 2 - Pre-Alpha', 'Development Status :: 2 - Pre-Alpha',
'Environment :: Web Environment', 'Environment :: Web Environment',
'Framework :: Django', 'Framework :: Django',
'Intended Audience :: Developers', 'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Affero General Public License v3 (GPLv3)' 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'Programming Language :: Python', 'Programming Language :: Python',
'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2',
......
[tox]
envlist = py27-django{18,111}
[testenv]
setenv =
DJANGO_SETTINGS_MODULE = eventtracking.django.tests.settings
PYTHONPATH = {toxinidir}
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/dev-requirements.txt
django18: Django>=1.8,<1.9
django111: Django>=1.11,<1.12
# These are the equivalent of 'make ci'.
commands =
nosetests --cover-erase --with-coverage --cover-branches -A 'not integration and not performance' --cover-min-percentage=95
nosetests --verbose --nocapture -a 'integration'
pep8 --config=.pep8 eventtracking
pylint --rcfile=pylintrc eventtracking
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment