From 6200112fe88f4853cebd3318c1bfe30da2b863d8 Mon Sep 17 00:00:00 2001
From: kashewnuts <kashun.nuts@gmail.com>
Date: Mon, 5 Feb 2024 14:44:31 +0900
Subject: [PATCH] =?UTF-8?q?pytest&pyproject.toml=E5=AF=BE=E5=BF=9C?=
 =?UTF-8?q?=E3=82=92=E3=82=84=E3=82=81=E3=81=A6=E3=80=81setup.py=E3=81=A7?=
 =?UTF-8?q?=E5=AE=9F=E8=A1=8C=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?=
 =?UTF-8?q?=E6=88=BB=E3=81=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 beproud/django/notify/tests/__init__.py |  4 ++
 beproud/django/notify/tests/settings.py | 62 -------------------------
 pyproject.toml                          | 37 ---------------
 setup.py                                | 15 +++---
 test_settings.py                        |  4 +-
 tox.ini                                 |  6 ---
 6 files changed, 14 insertions(+), 114 deletions(-)
 delete mode 100644 beproud/django/notify/tests/settings.py
 delete mode 100644 pyproject.toml

diff --git a/beproud/django/notify/tests/__init__.py b/beproud/django/notify/tests/__init__.py
index e69de29..49ba9c0 100644
--- a/beproud/django/notify/tests/__init__.py
+++ b/beproud/django/notify/tests/__init__.py
@@ -0,0 +1,4 @@
+from beproud.django.notify.tests.test_basic import *        #NOQA
+from beproud.django.notify.tests.test_mail import *         #NOQA
+from beproud.django.notify.tests.test_storage import *      #NOQA
+from beproud.django.notify.tests.test_tasks import *        #NOQA
diff --git a/beproud/django/notify/tests/settings.py b/beproud/django/notify/tests/settings.py
deleted file mode 100644
index 10c5752..0000000
--- a/beproud/django/notify/tests/settings.py
+++ /dev/null
@@ -1,62 +0,0 @@
-# Django3では、標準のdjango.conf.global_settingsの定数をオーバーライドすると例外が発生する場合がある。
-# https://github.com/django/django/blob/70035fb0444ae7c01613374212ca5e3c27c9782c/django/conf/__init__.py#L188
-# そのため、testではdjango.conf.global_settingsを直接利用せず、このtest用settings定数を使用する。
-
-import os
-import celery
-
-SECRET_KEY = "SECRET"
-INSTALLED_APPS = (
-    'django.contrib.auth',
-    'django.contrib.contenttypes',
-    'beproud.django.notify',
-)
-
-# kombu.exceptions.EncodeError: Object of type User is not JSON serializable エラーを抑止する
-# (参考)
-#   https://github.com/celery/celery/issues/5922
-#   https://stackoverflow.com/questions/49373825/kombu-exceptions-encodeerror-user-is-not-json-serializable
-CELERY_TASK_SERIALIZER = "pickle"
-
-DATABASES = {
-    'default': {
-        'ENGINE': 'django.db.backends.sqlite3',
-        'NAME': ':memory:',
-    }
-}
-
-BASE_PATH = os.path.dirname(__file__)
-
-TEMPLATES = [
-    {
-        'BACKEND': 'django.template.backends.django.DjangoTemplates',
-        'DIRS': [
-            os.path.join(BASE_PATH, 'beproud', 'django', 'notify', 'tests', 'templates')
-        ],
-    },
-]
-
-CELERY_TASK_ALWAYS_EAGER = True
-
-BPNOTIFY_MEDIA = {
-    "news": {
-        "verbose_name": "News",
-        "default_types": ("new_user", "follow", "private_msg"),
-        "backends": (
-            "beproud.django.notify.backends.model.ModelBackend",
-        ),
-    },
-    "private_messages": {
-        "verbose_name": "Private Message",
-        "default_types": ("private_msg", "notify_type_with_length_over_thirty"),
-        "backends": (
-            "beproud.django.notify.backends.model.ModelBackend",
-            "beproud.django.notify.backends.mail.EmailBackend",
-        ),
-    },
-}
-BPNOTIFY_SETTINGS_STORAGE = 'beproud.django.notify.storage.db.DBStorage'
-
-app = celery.Celery()
-app.config_from_object('django.conf:settings', namespace='CELERY')
-app.autodiscover_tasks(lambda: INSTALLED_APPS)
diff --git a/pyproject.toml b/pyproject.toml
deleted file mode 100644
index b9e443a..0000000
--- a/pyproject.toml
+++ /dev/null
@@ -1,37 +0,0 @@
-[build-system]
-requires = ["setuptools>=61.0.0", "wheel"]
-build-backend = "setuptools.build_meta"
-
-[project]
-name = "bpnotify"
-version = "0.48"
-authors = [
-  { name="BeProud Inc.", email="project@beproud.jp" },
-]
-description = "Notification routing for Django"
-readme = "README.rst"
-requires-python = ">=3.9"
-keywords=["django"]
-classifiers = [
-  "Development Status :: 3 - Alpha",
-  "License :: OSI Approved :: BSD License",
-  "Programming Language :: Python",
-  "Programming Language :: Python :: 3",
-  "Programming Language :: Python :: 3.9",
-  "Programming Language :: Python :: 3.10",
-  "Programming Language :: Python :: 3.11",
-  "Programming Language :: Python :: 3.12",
-  "Framework :: Django",
-  "Framework :: Django :: 3.2",
-  "Framework :: Django :: 4.2",
-  "Intended Audience :: Developers",
-  "Environment :: Plugins",
-  "Topic :: Software Development :: Libraries :: Python Modules",
-]
-dependencies = ["Django>=3.2", "six", "Celery"]
-
-[project.urls]
-Homepage = "https://github.com/beproud/bpnotify/"
-
-[tool.setuptools.packages.find]
-where = ["."]
diff --git a/setup.py b/setup.py
index 7bfab3c..3402eb8 100644
--- a/setup.py
+++ b/setup.py
@@ -14,14 +14,14 @@ def read_file(filename):
 
 setup(
     name='bpnotify',
-    version='0.48',
+    version='0.49',
     description='Notification routing for Django',
     author='BeProud',
     author_email='project@beproud.jp',
     long_description=read_file('README.rst'),
     long_description_content_type="text/x-rst",
     url='https://github.com/beproud/bpnotify/',
-    python_requires='>=3.6',
+    python_requires='>=3.9',
     classifiers=[
         'Development Status :: 3 - Alpha',
         'Environment :: Plugins',
@@ -30,11 +30,13 @@ def read_file(filename):
         'License :: OSI Approved :: BSD License',
         'Programming Language :: Python',
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.9',
+        'Programming Language :: Python :: 3.10',
+        'Programming Language :: Python :: 3.11',
+        'Programming Language :: Python :: 3.12',
         'Framework :: Django',
-        'Framework :: Django :: 2.2',
         'Framework :: Django :: 3.2',
+        'Framework :: Django :: 4.2',
         'Topic :: Software Development :: Libraries :: Python Modules',
     ],
     include_package_data=True,
@@ -42,9 +44,8 @@ def read_file(filename):
     namespace_packages=['beproud', 'beproud.django'],
     test_suite='tests.main',
     install_requires=[
-        'Django>=2.2',
-        'django-jsonfield>=1.0.1',
-        'Celery>=4.2',
+        'Django>=3.2',
+        'Celery>=5.2',
         'six',
     ],
     zip_safe=False,
diff --git a/test_settings.py b/test_settings.py
index 47da56d..240e1cd 100644
--- a/test_settings.py
+++ b/test_settings.py
@@ -2,8 +2,6 @@
 # https://github.com/django/django/blob/70035fb0444ae7c01613374212ca5e3c27c9782c/django/conf/__init__.py#L188
 # そのため、testではdjango.conf.global_settingsを直接利用せず、このtest用settings定数を使用する。
 
-import os
-
 SECRET_KEY = "SECRET"
 INSTALLED_APPS = (
     'django.contrib.auth',
@@ -24,6 +22,7 @@
     }
 }
 
+import os
 BASE_PATH = os.path.dirname(__file__)
 
 TEMPLATES = [
@@ -58,3 +57,4 @@
 
 # The name of the class to use to run the test suite
 TEST_RUNNER = 'django.test.runner.DiscoverRunner'
+
diff --git a/tox.ini b/tox.ini
index 887fe0d..3891b34 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,11 +3,6 @@
 envlist = py{39,310,311}-dj{32,42}-celery{52,53},py312-dj42-celery53
 skipsdist = True
 
-[pytest]
-python_files = tests test_*.py *_tests.py
-django_find_project = false
-DJANGO_SETTINGS_MODULE = beproud.django.notify.tests.settings
-
 [testenv]
 basepython =
     py39: python3.9
@@ -24,7 +19,6 @@ deps =
     dj42: Django>=4.2,<5.0
     celery52: celery>=5.2,<5.3
     celery53: celery>=5.3,<5.4
-# commands=pytest {posargs}
 commands=python setup.py test
 
 # tox-gh-actionsパッケージの設定