Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #42 from ambitioninc/develop
Browse files Browse the repository at this point in the history
2.3.0
  • Loading branch information
somewes authored Jun 29, 2023
2 parents b043f19 + d094b7a commit e0ca534
Show file tree
Hide file tree
Showing 18 changed files with 149 additions and 136 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# copied from django-cte
name: restraint tests
on:
push:
branches: [master]
pull_request:
branches: [master,develop]

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9']
# Time to switch to pytest or nose2??
# nosetests is broken on 3.10
# AttributeError: module 'collections' has no attribute 'Callable'
# https://github.com/nose-devs/nose/issues/1099
django:
- 'Django~=3.2.0'
- 'Django~=4.0.0'
- 'Django~=4.1.0'
- 'Django~=4.2.0'
experimental: [false]
exclude:
- python: '3.7'
django: 'Django~=4.0.0'
- python: '3.7'
django: 'Django~=4.1.0'
- python: '3.7'
django: 'Django~=4.2.0'
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}
- name: Setup
run: |
python --version
pip install --upgrade pip wheel
pip install -r requirements/requirements.txt
pip install -r requirements/requirements-testing.txt
pip install "${{ matrix.django }}"
pip freeze
- name: Run tests
env:
DB_SETTINGS: >-
{
"ENGINE":"django.db.backends.postgresql",
"NAME":"restraint",
"USER":"postgres",
"PASSWORD":"postgres",
"HOST":"localhost",
"PORT":"5432"
}
run: |
coverage run manage.py test restraint
coverage report --fail-under=98
continue-on-error: ${{ matrix.experimental }}
- name: Check style
run: flake8 restraint
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include README.rst
include LICENSE
include LICENSE
recursive-include requirements *
6 changes: 6 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Release Notes
=============

v2.3.0
-------
* Django 3.2 & 4.0 support
* Django <3.2 dropped
* Switched testing to github actions

v2.2.0
------
* Added `restraint_db_updated` signal that is called when the restraint database is updated
Expand Down
7 changes: 6 additions & 1 deletion manage.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/usr/bin/env python
import sys

from settings import configure_settings

# Show warnings about django deprecations - uncomment for version upgrade testing
import warnings
from django.utils.deprecation import RemovedInNextVersionWarning
warnings.filterwarnings('always', category=DeprecationWarning)
warnings.filterwarnings('always', category=PendingDeprecationWarning)
warnings.filterwarnings('always', category=RemovedInNextVersionWarning)

if __name__ == '__main__':
configure_settings()
Expand Down
8 changes: 3 additions & 5 deletions publish.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import subprocess

subprocess.call(['rm', '-r', 'dist/'])
subprocess.call(['pip', 'install', 'wheel'])
subprocess.call(['pip', 'install', 'twine'])
subprocess.call(['python', 'setup.py', 'clean', '--all'])
subprocess.call(['python', 'setup.py', 'register', 'sdist', 'bdist_wheel'])
subprocess.call(['python', '-m', 'pip', 'install', 'build', 'twine'])
subprocess.call(['python', '-m', 'build'])
subprocess.call(['twine', 'check', 'dist/*'])
subprocess.call(['twine', 'upload', 'dist/*'])
subprocess.call(['rm', '-r', 'dist/'])
subprocess.call(['rm', '-r', 'build/'])
2 changes: 1 addition & 1 deletion requirements/requirements-testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ coverage
coveralls
django-nose
django-dynamic-fixture
mock
flake8
psycopg2
2 changes: 2 additions & 0 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Django>=3.2
django-manager-utils>=3.1.0
1 change: 0 additions & 1 deletion restraint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
from .version import __version__


default_app_config = 'restraint.apps.RestraintConfig'
1 change: 0 additions & 1 deletion restraint/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
import django.db.models.deletion
Expand Down
5 changes: 0 additions & 5 deletions restraint/models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
from django.contrib.contenttypes.models import ContentType
from django.db import models

from six import python_2_unicode_compatible

from restraint.managers import PermSetManager, PermManager, PermLevelManager, PermAccessManager


@python_2_unicode_compatible
class PermSet(models.Model):
"""
This is essentially a group that has a name.
Expand Down Expand Up @@ -34,7 +31,6 @@ def __str__(self):
return f'{self.display_name}:{self.name}'


@python_2_unicode_compatible
class Perm(models.Model):
"""
This is the actual permission name specific to what each app will add, for example competition_all.
Expand All @@ -59,7 +55,6 @@ def __str__(self):
return f'{self.display_name}:{self.name}'


@python_2_unicode_compatible
class PermLevel(models.Model):
"""
Each specific Perm can have different levels of access for the same permission.
Expand Down
2 changes: 1 addition & 1 deletion restraint/tests/commands_tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.core.management import call_command
from django.test import SimpleTestCase
from mock import patch
from unittest.mock import patch


class UpdateRestraintDbTest(SimpleTestCase):
Expand Down
Loading

0 comments on commit e0ca534

Please sign in to comment.