Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test suite #82

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .coveragerc

This file was deleted.

50 changes: 12 additions & 38 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,20 @@
# ---------------------------------------------------------------------------
# Python support matrix per Django version
#
# 2.6 1.5 1.6
# 2.7 1.5 1.6 1.7 1.8 1.9 1.10 1.11
# 3.3 1.5 1.6 1.7 1.8
# 3.4 1.7 1.8 1.9 1.10 1.11 2.0
# 3.5 1.8 1.9 1.10 1.11 2.0
# 3.6 1.10 1.11 2.0
# ---------------------------------------------------------------------------
sudo: false
language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "pypy"
- "pypy3"

matrix:
include:
- { python: 2.6, env: TOXENV=py26-django15 }
- { python: 2.6, env: TOXENV=py26-django16 }
- { python: 2.7, env: TOXENV=py27-django15 }
- { python: 2.7, env: TOXENV=py27-django16 }
- { python: 2.7, env: TOXENV=py27-django17 }
- { python: 2.7, env: TOXENV=py27-django18 }
- { python: 2.7, env: TOXENV=py27-django19 }
- { python: 2.7, env: TOXENV=py27-django110 }
- { python: 2.7, env: TOXENV=py27-django111 }
- { python: 3.3, env: TOXENV=py33-django15 }
- { python: 3.3, env: TOXENV=py33-django16 }
- { python: 3.3, env: TOXENV=py33-django17 }
- { python: 3.3, env: TOXENV=py33-django18 }
- { python: 3.4, env: TOXENV=py34-django17 }
- { python: 3.4, env: TOXENV=py34-django18 }
- { python: 3.4, env: TOXENV=py34-django19 }
- { python: 3.4, env: TOXENV=py34-django110 }
- { python: 3.4, env: TOXENV=py34-django20 }
- { python: 3.4, env: TOXENV=py34-django111 }
- { python: 3.5, env: TOXENV=py35-django18 }
- { python: 3.5, env: TOXENV=py35-django19 }
- { python: 3.5, env: TOXENV=py35-django110 }
- { python: 3.5, env: TOXENV=py35-django111 }
- { python: 3.5, env: TOXENV=py35-django20 }
- { python: 3.6, env: TOXENV=py36-django110 }
- { python: 3.6, env: TOXENV=py36-django111 }
- { python: 3.6, env: TOXENV=py36-django20 }
- {python: "3.6", env: TOXENV=packaging}

install:
- pip install tox
- pip install tox tox-travis tox-venv
- pip install coveralls
script: tox
after_success:
- coveralls
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ Table of Contents
Requirements
============

``rules`` requires Python 2.6/3.3 or newer. It can optionally integrate with
Django, in which case requires Django 1.5 or newer.
``rules`` requires Python 2.7/3.4 or newer. It can optionally integrate with
Django, in which case requires Django 1.11 or newer.


How to install
Expand Down
Empty file removed rules/compat/__init__.py
Empty file.
150 changes: 0 additions & 150 deletions rules/compat/access_mixins.py

This file was deleted.

7 changes: 1 addition & 6 deletions rules/contrib/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@

from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth import mixins
from django.contrib.auth.views import redirect_to_login
from django.core.exceptions import PermissionDenied, ImproperlyConfigured, FieldError
from django.shortcuts import get_object_or_404
from django.utils import six
from django.utils.decorators import available_attrs
from django.utils.encoding import force_text

try:
from django.contrib.auth import mixins
except ImportError: # pragma: no cover
# Django < 1.9
from ..compat import access_mixins as mixins


# These are made available for convenience, as well as for use in Django
# versions before 1.9. For usage help see Django's docs for 1.9 or later.
Expand Down
9 changes: 2 additions & 7 deletions rules/templatetags/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@


register = template.Library()
try:
# Django < 2.0
simple_tag = register.assignment_tag
except AttributeError: # pragma: no cover
simple_tag = register.simple_tag


@simple_tag
@register.simple_tag
def test_rule(name, obj=None, target=None):
return default_rules.test_rule(name, obj, target)


@simple_tag
@register.simple_tag
def has_perm(perm, user, obj=None):
if not hasattr(user, 'has_perm'): # pragma: no cover
return False # swapped user model that doesn't support permissions
Expand Down
47 changes: 0 additions & 47 deletions runtests.py

This file was deleted.

7 changes: 0 additions & 7 deletions runtests.sh

This file was deleted.

16 changes: 11 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[nosetests]
verbosity=2
cover-package=rules
cover-erase=1
#cover-branches=1
[bdist_wheel]
universal = 1

[coverage:run]
source = rules

[coverage:report]
exclude_lines =
pragma: no cover
omit =
*/rules/apps.py
12 changes: 3 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,10 @@ def get_version(version):
'rules',
'rules.templatetags',
'rules.contrib',
'rules.compat',
],

install_requires=[
# 'Django >= 1.5',
],
tests_require=[
'nose',
'coverage',
'Django >= 1.5',
'Django',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please move the Django requirement back to "tests_require" so it's still optional? Rules should be able to be used standalone without Django.

Copy link
Contributor Author

@rpkilby rpkilby Jun 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Should I just remove it entirely then? The tests_require isn't used by tox.

Sorry - to be clear, I'm suggesting that tests_require isn't necessary, since tests are ran through tox, not python setup.py test.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Let’s remove it completely then.

],

classifiers=[
Expand All @@ -69,9 +63,9 @@ def get_version(version):
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
Expand Down
5 changes: 0 additions & 5 deletions tests/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@
import os
import sys

from os.path import abspath, dirname, join

if __name__ == "__main__":
project_dir = dirname(dirname(abspath(__file__)))
sys.path.insert(0, project_dir)
sys.path.insert(0, join(project_dir, 'tests'))

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testapp.settings")

from django.core.management import execute_from_command_line
Expand Down
Loading