Permalink
Browse files

Consolidate requirements, remove django\<1.8 artifacts, update tests …

…and reverse monkey_patching
  • Loading branch information...
benjaoming committed Oct 12, 2016
1 parent 217c8b9 commit 3979aa81c2de8923d8b3def46855533881ab0c6a
View
@@ -0,0 +1,2 @@
[run]
omit = */tests/*
View
@@ -27,7 +27,7 @@ lint:
pep8 wiki
test:
./runtests.py
pytest
test-all:
tox
View
@@ -3,3 +3,4 @@ django_find_project = false
python_files=test_*.py
testpaths=wiki
norecursedirs=testproject .svn _build tmp* dist *.egg-info
DJANGO_SETTINGS_MODULE=wiki.tests.settings
View

This file was deleted.

Oops, something went wrong.
View
@@ -3,8 +3,6 @@
from __future__ import absolute_import, unicode_literals
import os
from sys import version_info as PYTHON_VERSION
from setuptools import find_packages, setup
from wiki import __version__
@@ -14,8 +12,6 @@
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def get_path(fname):
return os.path.join(os.path.dirname(__file__), fname)
@@ -25,52 +21,16 @@ def read(fname):
requirements = [
"Django>=1.5",
"Django>=1.8",
"Pillow",
"django-nyt>=0.9.7.2,<1.0",
"six",
"django-mptt>=0.8.6,<0.9",
"django-sekizai>=0.10",
"sorl-thumbnail>=12,<13",
"Markdown>=2.6,<2.7",
]
# Requirements that depend on Django version: South and sorl-thumbnail
try:
from django import VERSION as DJANGO_VERSION
except ImportError:
# No Django so assuming that one will get installed, but we don't know which
# one.
# We will assume it's a very recent one and base the requirements on that...
requirements.append("sorl-thumbnail>=12")
# 0.6.1 broken: https://github.com/django-mptt/django-mptt/issues/316
requirements.append("django-mptt>=0.8")
requirements.append("django-sekizai>=0.9")
else:
if DJANGO_VERSION < (1, 7):
requirements.append("South>=1.0.1")
requirements.append("django-mptt>=0.7.1,<0.8")
requirements.append("django-sekizai<0.9")
elif DJANGO_VERSION < (1, 8):
# Fixes
# AttributeError: 'URLPath' object has no attribute 'get_deferred_fields'
requirements.append("django-mptt>=0.7.1,<0.8")
requirements.append("django-sekizai>=0.9")
else:
# Latest django-mptt only works for Django 1.8+
requirements.append("django-mptt>=0.8.6,<0.9")
requirements.append("django-sekizai>=0.9")
if DJANGO_VERSION < (1, 5):
# For Django 1.4, use sorl-thumbnail<11.12.1:
# https://github.com/mariocesar/sorl-thumbnail/issues/255
requirements.append("sorl-thumbnail<11.12.1")
else:
requirements.append("sorl-thumbnail>=12,<13")
if PYTHON_VERSION < (2, 7):
# For Python 2.6, use Markdown<2.5.0, see
# https://github.com/waylan/Python-Markdown/issues/349
requirements.append("Markdown>2.2.0,<2.5.0")
else:
requirements.append("Markdown>2.2.0,<2.7")
packages = find_packages()
@@ -13,7 +13,6 @@
import os
from django import VERSION
from django.core.urlresolvers import reverse_lazy
@@ -32,9 +31,6 @@
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.humanize',
'django.contrib.auth',
@@ -57,10 +53,8 @@
'wiki.plugins.notifications',
'mptt',
]
if VERSION < (1, 7):
INSTALLED_APPS.append('south')
else:
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
MIDDLEWARE_CLASSES = [
View
13 tox.ini
@@ -5,24 +5,27 @@ envlist = {py27,py34,py35}-django{18,19,110}
[testenv]
commands =
{envbindir}/coverage run --source=wiki runtests.py
{envbindir}/pytest --cov=wiki --cov-config .coveragerc
usedevelop = true
deps =
coverage
pytest
pytest-django
pytest-cov
Pillow==2.3.0
django-classy-tags==0.4
six>=1.9
mock>=2.0
Markdown==2.6.5
Markdown==2.6.7
django_nyt==0.9.8
django18: Django==1.8.2
django19: Django==1.9
django110: Django==1.10
django110: Django==1.10.2
django{18,19,110}: django-mptt==0.8.6
django{18,19,110}: django-sekizai==0.9.0
django{18,19,110}: django-sekizai==0.10.0
django{18,19,110}: sorl-thumbnail==12.3
django{18,19,110}: pytest-django>=3
basepython =
py27: python2.7
View
@@ -1,17 +1,16 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
# -*- coding: utf-8 -*-
from django import VERSION
from django.conf import settings as django_settings
from django.core.exceptions import ImproperlyConfigured
import warnings
from six import string_types
from six import string_types, text_type
# TODO: Don't use wildcards
from .article import * # noqa
from .pluginbase import * # noqa
from .urlpath import * # noqa
from django.utils.functional import lazy
# TODO: Should the below stuff be executed a more logical place?
# Follow Django's default_settings.py / settings.py pattern and put these
@@ -64,16 +63,6 @@
raise ImproperlyConfigured(
'django-wiki: You need to change from django_notify to django_nyt in INSTALLED_APPS and your urlconfig.')
######################
# Warnings
######################
if VERSION < (1, 7):
if 'south' not in django_settings.INSTALLED_APPS:
warnings.warn(
"django-wiki: No south in your INSTALLED_APPS. This is highly discouraged.")
from django.core import urlresolvers # noqa
@@ -108,4 +97,20 @@ def reverse(*args, **kwargs):
return url
# Now we redefine reverse method
reverse_lazy = lazy(reverse, text_type)
urlresolvers.reverse = reverse
urlresolvers.reverse_lazy = reverse_lazy
# Patch up other locations of the reverse function
try:
from django.urls import base
from django import urls
from django import shortcuts
base.reverse = reverse
base.reverse_lazy = reverse_lazy
urls.reverse = reverse
urls.reverse_lazy = reverse_lazy
shortcuts.reverse = reverse
urls.reverse_lazy = reverse_lazy
except ImportError:
pass
@@ -1,7 +1,6 @@
from __future__ import absolute_import, unicode_literals
from django import VERSION as DJANGO_VERSION
from django.conf.urls import patterns, url
from django.conf.urls import url
from wiki.plugins.attachments import views
urlpatterns = [
@@ -33,6 +32,3 @@
views.AttachmentChangeRevisionView.as_view(),
name='attachments_revision_change'),
]
if DJANGO_VERSION < (1, 8):
urlpatterns = patterns('', *urlpatterns)
Oops, something went wrong.

0 comments on commit 3979aa8

Please sign in to comment.