Skip to content

Commit

Permalink
Python2/3 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
hugorodgerbrown committed Apr 8, 2017
1 parent d95afa8 commit 0c1a01f
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 28 deletions.
12 changes: 5 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
language:
python

python
python:
3.6

- "2.7"
- "3.6"
install:
pip install tox

pip install tox-travis
script:
tox
tox
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include LICENCE
include LICENSE
include README.rst
7 changes: 0 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
.. image:: https://badge.fury.io/py/django-side-effects.svg
:target: https://badge.fury.io/py/django-side-effects

**Python3 and Django 2.0**

The latest version of Django, 1.11 is the last to support Python 2, and so
in advance of the migration to Django 2.0 this package will also now only
support Python 3 officially. If you need to support earlier Django versions
please use the ``python27`` branch.

Django Side Effects
===================

Expand Down
11 changes: 6 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,25 @@

setup(
name="django-side-effects",
version="0.2-dev",
version="0.2",
packages=find_packages(),
include_package_data=True,
install_requires=['Django>=1.8'],
description='Django app for managing external side effects.',
long_description=README,
url='https://github.com/yunojuno/django-side-effects',
author='Hugo Rodger-Brown',
author='YunoJuno',
author_email='[email protected]',
license='MIT',
maintainer='Hugo Rodger-Brown',
maintainer_email='[email protected]',
maintainer='YunoJuno',
maintainer_email='[email protected]',
classifiers=[
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
Expand Down
2 changes: 2 additions & 0 deletions side_effects/apps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import logging

from django.apps import AppConfig
Expand Down
6 changes: 6 additions & 0 deletions side_effects/compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
"""Python 2/3 compatibility imports."""
try:
from unittest import mock
except ImportError:
import mock # noqa
2 changes: 1 addition & 1 deletion side_effects/management/commands/display_side_effects.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-

from __future__ import unicode_literals

import json

Expand Down
4 changes: 3 additions & 1 deletion side_effects/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
This module contains the Registry class that is responsible for managing
all of the registered side-effects.
"""
from __future__ import unicode_literals

from collections import defaultdict
import logging
import threading
Expand Down Expand Up @@ -88,7 +90,7 @@ def _run_func(func, *args, **kwargs):
"""Run a single side-effect function and handle errors."""
try:
func(*args, **kwargs)
except:
except Exception:
logger.exception("Error running side_effect function '%s'", fname(func))


Expand Down
5 changes: 2 additions & 3 deletions side_effects/tests.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-


from unittest import mock
from __future__ import unicode_literals

from django.test import TestCase

from . import registry, decorators
from .compat import mock


def test_func_no_docstring(arg1, kwarg1=None):
Expand Down
8 changes: 5 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[tox]
envlist = py{36}-django{111}
envlist = py{27,36}-django{18,19,110,111}

[testenv]
ignore_errors = True

deps =
coverage==4.2
py27: mock==2.0
django18: Django==1.8
django19: Django==1.9
django110: Django==1.10
django111: Django==1.11

commands=
Expand Down

0 comments on commit 0c1a01f

Please sign in to comment.