Skip to content

Commit

Permalink
chore: Cleanup Post Django32 (#214)
Browse files Browse the repository at this point in the history
Co-authored-by: Mohammad Ahtasham ul Hassan <ahthassan74@gmail.com>
  • Loading branch information
edx-requirements-bot and aht007 authored Jan 28, 2022
1 parent 26dc6b6 commit 99653e2
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8']
toxenv: [django22, django30, django31, django32, quality, docs, without-django]
toxenv: [quality, docs, without-django, django32, django40]

steps:
- uses: actions/checkout@v2
Expand All @@ -36,7 +36,7 @@ jobs:
run: tox -- --hypothesis-profile=ci

- name: Run Coverage
if: matrix.python-version == '3.8' && matrix.toxenv=='django22'
if: matrix.python-version == '3.8' && matrix.toxenv=='django32'
uses: codecov/codecov-action@v1
with:
flags: unittests
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.3.0

* Added Support for Django40 and removed Django22, 30 and 31

# 2.2.2

* Moved django pin from django.in to constraint.txt. Upgraded dependencies
Expand Down
4 changes: 2 additions & 2 deletions opaque_keys/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"""
from abc import ABCMeta, abstractmethod
from functools import total_ordering
from stevedore.enabled import EnabledExtensionManager

# pylint: disable=wrong-import-order
from _collections import defaultdict
from stevedore.enabled import EnabledExtensionManager

__version__ = '2.2.2'
__version__ = '2.3.0'


class InvalidKeyError(Exception):
Expand Down
5 changes: 5 additions & 0 deletions opaque_keys/edx/django/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Useful django models for implementing XBlock infrastructure in django.
If Django is unavailable, none of the classes below will work as intended.
"""
# pylint: disable=abstract-method
import logging
import warnings

Expand All @@ -27,6 +28,7 @@ class _Creator:
A placeholder class that provides a way to set the attribute on the model.
"""

def __init__(self, field):
self.field = field

Expand All @@ -45,6 +47,7 @@ class CreatorMixin:
Mixin class to provide SubfieldBase functionality to django fields.
See: https://docs.djangoproject.com/en/1.11/releases/1.8/#subfieldbase
"""

def contribute_to_class(self, cls, name, *args, **kwargs):
super().contribute_to_class(cls, name, *args, **kwargs)
setattr(cls, name, _Creator(self))
Expand Down Expand Up @@ -168,6 +171,7 @@ class OpaqueKeyFieldEmptyLookupIsNull(IsNull):
This overrides the default __isnull model filter to help enforce the special way
we handle null / empty values in OpaqueKeyFields.
"""

def get_prep_lookup(self):
raise TypeError("Use this field's .Empty member rather than None or __isnull "
"to query for missing objects of this type.")
Expand Down Expand Up @@ -214,6 +218,7 @@ class LocationKeyField(UsageKeyField):
"""
A django Field that stores a UsageKey object as a string.
"""

def __init__(self, *args, **kwargs):
warnings.warn("LocationKeyField is deprecated. Please use UsageKeyField instead.", stacklevel=2)
super().__init__(*args, **kwargs)
Expand Down
7 changes: 1 addition & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
import os
import re

import os
import re

from setuptools import find_packages, setup


Expand Down Expand Up @@ -106,10 +103,8 @@ def get_version(*file_paths):
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Framework :: Django",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.0",
"Framework :: Django :: 3.1",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
],
# We are including the tests because other libraries do use mixins from them.
packages=find_packages(),
Expand Down
36 changes: 16 additions & 20 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
[tox]
envlist = py38-django{22,30,31,32},quality,without-django
envlist = py38-django{32,40},quality,without-django
skip_missing_interpreters = True

[testenv]
deps =
django22: Django>=2.2,<2.3
django30: Django>=3.0,<3.1
django31: Django>=3.1,<3.2
django32: Django>=3.2,<3.3
-r{toxinidir}/requirements/django-test.txt
commands = pytest --disable-pytest-warnings --nomigrations {posargs}
deps =
django32: Django>=3.2,<4.0
django40: Django>=4.0,<4.1
-r{toxinidir}/requirements/django-test.txt
commands = pytest -v --disable-pytest-warnings --nomigrations {posargs}

[testenv:without-django]
deps =
-r{toxinidir}/requirements/test.txt
deps =
-r{toxinidir}/requirements/test.txt
commands = pytest --disable-pytest-warnings --ignore=opaque_keys/edx/django {posargs}

[testenv:quality]
commands =
pycodestyle --config=.pep8 opaque_keys
pylint --rcfile=pylintrc opaque_keys
commands =
pycodestyle --config=.pep8 opaque_keys
pylint --rcfile=pylintrc opaque_keys

[testenv:docs]
deps =
deps =
-r{toxinidir}/requirements/doc.txt
allowlist_externals =
allowlist_externals =
make
env
setenv =
# -W will treat warnings as errors.
setenv =
SPHINXOPTS = -W
commands =
# -e allows for overriding setting from the environment.
# -C changes the directory to `docs` before running the command.
commands =
make -e -C docs clean
make -e -C docs html

0 comments on commit 99653e2

Please sign in to comment.