-
Notifications
You must be signed in to change notification settings - Fork 2
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
support Python3.10 over & Django4.2 #15
Conversation
d9f3c04
to
42bfb0f
Compare
42bfb0f
to
13f9dfe
Compare
d2087e9
to
01ab87e
Compare
01ab87e
to
6200112
Compare
@@ -3,11 +3,9 @@ | |||
|
|||
from django.contrib.contenttypes.models import ContentType | |||
from django.contrib.contenttypes.fields import GenericForeignKey | |||
from django.utils.translation import ugettext_lazy as _ | |||
from django.utils.translation import gettext_lazy as _ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
django.utils.translation.ugettext() はDjango4.0で削除 https://docs.djangoproject.com/en/5.0/releases/4.0/#features-removed-in-4-0
@@ -42,7 +40,7 @@ class Notification(models.Model): | |||
notify_type = models.CharField(_('notify type'), max_length=100, db_index=True) | |||
media = models.CharField(_('media'), max_length=100, choices=MediaChoices(), db_index=True) | |||
|
|||
extra_data = jsonfield.JSONField(_('extra data'), null=True, blank=True) | |||
extra_data = models.JSONField(_('extra data'), null=True, blank=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Django標準のものを使うようにするので置き換え https://docs.djangoproject.com/en/5.0/ref/models/fields/#django.db.models.JSONField
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MEMO: 旧バージョンのbpnotify使ってたプロジェクトの場合は、自プロジェクトでマイグレーションが必要
tests/test_mail.py
Outdated
@@ -20,20 +20,20 @@ def test_sending_mail(self): | |||
# 1 private_messages model | |||
# 1 news model | |||
# 1 private_messages mail | |||
self.assertEquals(items_sent, 3) | |||
self.assertEqual(items_sent, 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DeprecationWarning: Please use assertEqual instead.
が出ていたのでごそっと置き換え
tests/test_mail.py
Outdated
@@ -4,7 +4,7 @@ | |||
from django.core import mail | |||
from django.test import TestCase | |||
|
|||
from beproud.django.notify.tests.base import TestBase | |||
from tests.base import TestBase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
プロジェクトルートにtestsディレクトリを置く形式にしたのでPATHを変更。以降も同様の変更あり。
@@ -29,75 +29,75 @@ def test_sending_model(self): | |||
user = User.objects.get(pk=2) | |||
items_sent = notify_now(user, 'follow', extra_data={"followed": "eggs"}) | |||
# 1 news model | |||
self.assertEquals(items_sent, 1) | |||
self.assertEqual(items_sent, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DeprecationWarning: Please use assertEqual instead.
が出ていたのでごそっと置き換え
pytest | ||
pytest-django | ||
pytest-pythonpath | ||
setuptools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setuptoolsベースのプロジェクトを実行するためにsetup.pyを準備しているが、Python3.12から依存から外れるので明記
'Topic :: Software Development :: Libraries :: Python Modules', | ||
], | ||
include_package_data=True, | ||
packages=find_packages(), | ||
namespace_packages=['beproud', 'beproud.django'], | ||
test_suite='tests.main', | ||
install_requires=[ | ||
'Django>=2.2', | ||
'django-jsonfield>=1.0.1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
django-jsonfieldはアーカイブ済み¬ifyではDjango標準のものを使うようにしたので削除
], | ||
zip_safe=False, | ||
) | ||
setup(test_suite="tests.main") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setup.pyで実行されるコマンドは非推奨になっていっているが、pytest移行が難しそうなのでそこだけ残した (対応Issueは起票済み #16)
@@ -0,0 +1,37 @@ | |||
[build-system] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pytest化されたとき、setup.pyファイルは削除だけすればよいようにsetup.pyで実行していた内容をpyproject.tomlに移植。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
@@ -42,7 +40,7 @@ class Notification(models.Model): | |||
notify_type = models.CharField(_('notify type'), max_length=100, db_index=True) | |||
media = models.CharField(_('media'), max_length=100, choices=MediaChoices(), db_index=True) | |||
|
|||
extra_data = jsonfield.JSONField(_('extra data'), null=True, blank=True) | |||
extra_data = models.JSONField(_('extra data'), null=True, blank=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MEMO: 旧バージョンのbpnotify使ってたプロジェクトの場合は、自プロジェクトでマイグレーションが必要
具体的な変更内容
python -m build && twine check時のログ