Skip to content

Commit

Permalink
Merge pull request #2 from saleem-latif/removing-python2-support
Browse files Browse the repository at this point in the history
Removing python 2 support.
  • Loading branch information
saleem-latif authored Oct 2, 2019
2 parents 253ed58 + af69f4d commit b0d1d58
Show file tree
Hide file tree
Showing 30 changed files with 75 additions and 65 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
language: python

python:
- 2.7
- 3.5

matrix:
include:
- python: 3.5
env: TOXENV=quality
- python: 2.7
env: TOXENV=quality

script:
- make clean
Expand Down
5 changes: 1 addition & 4 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file requirements/base.txt requirements/base.in
# pip-compile --output-file=requirements/base.txt requirements/base.in
#
--index-url https://pypi.org/simple/
--extra-index-url https://saleem.latif:AP81xRt5DR6ruigseCVZpcYxA1QFyuHvZ4ky6m@intechww.jfrog.io/intechww/api/pypi/pypi-virtual/simple

django==1.11.25
importlib-metadata==0.23 # via path.py
more-itertools==7.2.0 # via zipp
Expand Down
4 changes: 0 additions & 4 deletions requirements/dev.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Additional requirements for development of this application

diff-cover # Changeset diff test coverage
pip-tools # Requirements file management
tox # virtualenv management for tests
tox-battery==0.5 # Makes tox aware of requirements file changes (it's experimental, so keep it pinned)
twine # Utility for PyPI package uploads
wheel # For generation of wheels for PyPI
28 changes: 6 additions & 22 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,58 @@
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file requirements/dev.txt requirements/base.in requirements/dev.in requirements/quality.in requirements/test.in
# pip-compile --output-file=requirements/dev.txt requirements/base.in requirements/dev.in requirements/quality.in requirements/test.in
#
--index-url https://pypi.org/simple/
--extra-index-url https://saleem.latif:AP81xRt5DR6ruigseCVZpcYxA1QFyuHvZ4ky6m@intechww.jfrog.io/intechww/api/pypi/pypi-virtual/simple

argparse==1.4.0 # via caniusepython3
astroid==2.3.1 # via pylint
atomicwrites==1.3.0 # via pytest
attrs==19.2.0 # via pytest
backports.functools-lru-cache==1.5 # via caniusepython3
bleach==3.1.0 # via readme-renderer
caniusepython3==7.1.0
certifi==2019.9.11 # via requests
chardet==3.0.4 # via requests
click==7.0 # via pip-tools
coverage==4.5.4 # via pytest-cov
ddt==1.2.1
diff-cover==2.3.0
distlib==0.2.9.post0 # via caniusepython3
django==1.11.25
docutils==0.15.2 # via readme-renderer
factory-boy==2.12.0
faker==2.0.2 # via factory-boy
filelock==3.0.12 # via tox
idna==2.8 # via requests
importlib-metadata==0.23 # via path.py, pluggy, pytest, tox
inflect==2.1.0 # via jinja2-pluralize
isort==4.3.21
jinja2-pluralize==0.3.0 # via diff-cover
jinja2==2.10.1 # via diff-cover, jinja2-pluralize
lazy-object-proxy==1.4.2 # via astroid
markupsafe==1.1.1 # via jinja2
mccabe==0.6.1 # via pylint
mock==3.0.5
more-itertools==7.2.0 # via pytest, zipp
packaging==19.2 # via caniusepython3, pytest, tox
path.py==12.0.1
pep8==1.7.1
pip-tools==4.1.0
pkginfo==1.5.0.1 # via twine
pluggy==0.13.0 # via pytest, tox
py==1.8.0 # via pytest, tox
pycodestyle==2.5.0
pydocstyle==4.0.1
pygments==2.4.2 # via diff-cover, readme-renderer
pylint==2.4.2
pyparsing==2.4.2 # via packaging
pytest-cov==2.7.1
pytest-django==3.5.1
pytest==5.2.0 # via pytest-cov, pytest-django
python-dateutil==2.8.0 # via faker
pytz==2019.2 # via django
readme-renderer==24.0 # via twine
requests-toolbelt==0.9.1 # via twine
requests==2.22.0 # via caniusepython3, requests-toolbelt, twine
six==1.12.0 # via astroid, bleach, diff-cover, faker, mock, packaging, pip-tools, python-dateutil, readme-renderer, tox
requests==2.22.0 # via caniusepython3
six==1.12.0 # via astroid, faker, mock, packaging, pip-tools, python-dateutil, tox
snowballstemmer==1.9.1 # via pydocstyle
text-unidecode==1.3 # via faker
toml==0.10.0 # via tox
tox-battery==0.5
tox==3.14.0
tqdm==4.36.1 # via twine
twine==2.0.0
typed-ast==1.4.0 # via astroid
urllib3==1.25.6 # via requests
virtualenv==16.7.5 # via tox
wcwidth==0.1.7 # via pytest
webencodings==0.5.1 # via bleach
wheel==0.33.6
wrapt==1.11.2 # via astroid
zipp==0.6.0 # via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools==41.2.0 # via caniusepython3
8 changes: 4 additions & 4 deletions requirements/quality.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file requirements/quality.txt requirements/base.in requirements/quality.in requirements/test.in
# pip-compile --output-file=requirements/quality.txt requirements/base.in requirements/quality.in requirements/test.in
#
--index-url https://pypi.org/simple/
--extra-index-url https://saleem.latif:AP81xRt5DR6ruigseCVZpcYxA1QFyuHvZ4ky6m@intechww.jfrog.io/intechww/api/pypi/pypi-virtual/simple

argparse==1.4.0 # via caniusepython3
astroid==2.3.1 # via pylint
atomicwrites==1.3.0 # via pytest
Expand Down Expand Up @@ -51,3 +48,6 @@ urllib3==1.25.6 # via requests
wcwidth==0.1.7 # via pytest
wrapt==1.11.2 # via astroid
zipp==0.6.0 # via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools==41.2.0 # via caniusepython3
5 changes: 1 addition & 4 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file requirements/test.txt requirements/base.in requirements/test.in
# pip-compile --output-file=requirements/test.txt requirements/base.in requirements/test.in
#
--index-url https://pypi.org/simple/
--extra-index-url https://saleem.latif:AP81xRt5DR6ruigseCVZpcYxA1QFyuHvZ4ky6m@intechww.jfrog.io/intechww/api/pypi/pypi-virtual/simple

atomicwrites==1.3.0 # via pytest
attrs==19.2.0 # via pytest
coverage==4.5.4 # via pytest-cov
Expand Down
1 change: 1 addition & 0 deletions settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
from __future__ import absolute_import

import os
from path import Path
Expand Down
2 changes: 2 additions & 0 deletions test_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"""
Utility functions for theming tests.
"""
from __future__ import absolute_import

import os

from path import Path

from django.conf import settings
Expand Down
6 changes: 4 additions & 2 deletions test_utils/factories.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Theming Factories.
"""
from __future__ import absolute_import

import factory
from factory.django import DjangoModelFactory

Expand All @@ -14,7 +16,7 @@ class SiteFactory(DjangoModelFactory):
Factory for django.contrib.sites.models.Site.
"""

class Meta(object):
class Meta:
model = Site
django_get_or_create = ('domain',)

Expand All @@ -27,7 +29,7 @@ class ThemeFactory(DjangoModelFactory):
Factory for theming.models.Theme.
"""

class Meta(object):
class Meta:
model = Theme
django_get_or_create = ('site',)

Expand Down
4 changes: 2 additions & 2 deletions test_utils/testcases.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""
Module containing functions and methods common to all theme related tests.
"""
from __future__ import absolute_import

from django.test import TestCase as DjangoTestCase


class TestCase(DjangoTestCase):
"""
Base test case for theme tests.
"""

pass
2 changes: 2 additions & 0 deletions test_utils/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Utility functions used by the tests in `theming` app.
"""
from __future__ import absolute_import

from django.test import RequestFactory

from theming.thread_locals import get_current_request, set_current_request, set_current_theme
Expand Down
10 changes: 6 additions & 4 deletions tests/test_theming/test_apps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Validate ThemingConfig
"""
from __future__ import absolute_import

import ddt
from six import assertRaisesRegex

Expand Down Expand Up @@ -73,9 +75,9 @@ def test_ready_with_missing_theme_settings(self): # pylint: disable=invalid-nam
"""
del settings.THEMING
with assertRaisesRegex(
self,
ImproperlyConfigured,
r'"THEMING" setting not set in django settings file. '
r'If you are not using theming then remove it from INSTALLED_APPS.'
self,
ImproperlyConfigured,
r'"THEMING" setting not set in django settings file. '
r'If you are not using theming then remove it from INSTALLED_APPS.'
):
self.theming_config.ready()
2 changes: 2 additions & 0 deletions tests/test_theming/test_core.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Validate theming core.
"""
from __future__ import absolute_import

import os

import ddt
Expand Down
1 change: 1 addition & 0 deletions tests/test_theming/test_middleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Validate theming middleware.
"""
from __future__ import absolute_import

from django.test import RequestFactory

Expand Down
3 changes: 3 additions & 0 deletions tests/test_theming/test_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# pylint: disable=no-member
"""
Validate theming models.
"""
from __future__ import absolute_import

from functools import partial

import ddt
Expand Down
2 changes: 2 additions & 0 deletions tests/test_theming/test_static/test_finders.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Tests to validate theme finders work as expected.
"""
from __future__ import absolute_import

import ddt

from django.core.checks import Error
Expand Down
2 changes: 2 additions & 0 deletions tests/test_theming/test_static/test_storage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Tests to validate theme storage classes work as expected..
"""
from __future__ import absolute_import

import ddt

from django.conf import settings
Expand Down
2 changes: 2 additions & 0 deletions tests/test_theming/test_template/test_loaders/test_theme.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Validate theme template loaders.
"""
from __future__ import absolute_import

from functools import partial

import ddt
Expand Down
2 changes: 2 additions & 0 deletions tests/test_theming/test_thread_locals.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Validate thread_locals module of theming.
"""
from __future__ import absolute_import

from functools import partial
from threading import local

Expand Down
5 changes: 4 additions & 1 deletion theming/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
"""
Module to hold all the nuts and bolts for theming a django site.
"""
from __future__ import absolute_import

from .core import get_base_dir, get_themes, is_enabled

__version__ = "0.1.0"

from .core import is_enabled, get_base_dir, get_themes

default_app_config = "theming.apps.ThemingConfig" # pylint: disable=invalid-name
2 changes: 2 additions & 0 deletions theming/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Module containing admin interfaces for the theming app.
"""
from __future__ import absolute_import

from django.contrib import admin

from .models import Theme
Expand Down
14 changes: 8 additions & 6 deletions theming/apps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
App Config for theming.
"""
from __future__ import absolute_import

import os

from django.apps import AppConfig
Expand Down Expand Up @@ -33,27 +35,27 @@ def ready(self):
'"THEMING" setting not set in django settings file. '
'If you are not using theming then remove it from INSTALLED_APPS.'
)
elif 'DIRS' not in settings.THEMING:
if 'DIRS' not in settings.THEMING:
raise ImproperlyConfigured(
'The THEMING["DIRS"] setting must be populated.',
)
elif 'ENABLED' not in settings.THEMING:
if 'ENABLED' not in settings.THEMING:
raise ImproperlyConfigured(
'The THEMING["ENABLED"] setting must be populated.',
)
elif not isinstance(settings.THEMING['DIRS'], (list, tuple)):
if not isinstance(settings.THEMING['DIRS'], (list, tuple)):
raise ImproperlyConfigured(
'The THEMING["DIRS"] setting is not a tuple or list. Perhaps you forgot a trailing comma?',
)
elif not all([isinstance(theme_dir, str) for theme_dir in settings.THEMING['DIRS']]):
if not all([isinstance(theme_dir, str) for theme_dir in settings.THEMING['DIRS']]):
raise ImproperlyConfigured(
'THEMING["DIRS"] must contain only string paths.',
)
elif not all([theme_dir.startswith("/") for theme_dir in settings.THEMING['DIRS']]):
if not all([theme_dir.startswith("/") for theme_dir in settings.THEMING['DIRS']]):
raise ImproperlyConfigured(
'THEMING["DIRS"] must contain only absolute paths to themes dirs.',
)
elif not all([os.path.isdir(theme_dir) for theme_dir in settings.THEMING['DIRS']]):
if not all([os.path.isdir(theme_dir) for theme_dir in settings.THEMING['DIRS']]):
raise ImproperlyConfigured(
'THEMING["DIRS"] must contain valid paths.',
)
2 changes: 2 additions & 0 deletions theming/core.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Core logic for Theming.
"""
from __future__ import absolute_import, division

import os

from path import Path
Expand Down
Loading

0 comments on commit b0d1d58

Please sign in to comment.