From a5e7ee1ec2e5518ca0fbeaa9fa60f225fac9c3fe Mon Sep 17 00:00:00 2001 From: blag Date: Fri, 8 Sep 2023 12:06:37 -0700 Subject: [PATCH 1/5] Include migrations and bump version to 3.3.1 --- CHANGELOG.md | 8 ++++++++ MANIFEST.in | 1 + account/__init__.py | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d263ac8a..52557c40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ BI indicates a backward incompatible change. Take caution when upgrading to a version with these. Your code will need to be updated to continue working. +## 3.3.1 + +* #373 Re-include migrations in distribution + +## 3.3.0 + +* #370 Drop Django 2.2, fix timezone-aware comparison, packaging tweaks + ## 3.2.1 * #364 - Performance fix to admin classes diff --git a/MANIFEST.in b/MANIFEST.in index 372ea448..58451c66 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,6 +4,7 @@ include README.md recursive-include account *.html recursive-include account *.txt recursive-include account/locale * +recursive-include account/migrations * recursive-include docs *.rst exclude tox.ini recursive-exclude django_user_accounts.egg-info * diff --git a/account/__init__.py b/account/__init__.py index 88c513ea..ff041687 100644 --- a/account/__init__.py +++ b/account/__init__.py @@ -1 +1 @@ -__version__ = "3.3.0" +__version__ = "3.3.1" From d71857f2021c56a5f670ac86de651c5f5752f074 Mon Sep 17 00:00:00 2001 From: blag Date: Fri, 8 Sep 2023 15:25:48 -0700 Subject: [PATCH 2/5] Ignore more files in distribution --- MANIFEST.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 58451c66..ee1f9ed9 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,10 +1,11 @@ +global-exclude *.py[cod] include CHANGELOG.md include LICENSE include README.md recursive-include account *.html recursive-include account *.txt recursive-include account/locale * -recursive-include account/migrations * +recursive-include account/migrations *.py recursive-include docs *.rst exclude tox.ini recursive-exclude django_user_accounts.egg-info * From 9168748b0d44facb373f14d772cbe83e19d2e01d Mon Sep 17 00:00:00 2001 From: blag Date: Fri, 8 Sep 2023 15:25:13 -0700 Subject: [PATCH 3/5] Move tests back under account --- .github/workflows/ci.yaml | 2 +- MANIFEST.in | 1 - {tests => account/tests}/__init__.py | 0 {tests => account/tests}/settings.py | 4 ++-- .../account/email/email_confirmation_message.txt | 0 .../account/email/email_confirmation_subject.txt | 0 .../templates/account/email/password_change.txt | 0 .../account/email/password_change_subject.txt | 0 .../tests}/templates/account/email/password_reset.txt | 0 .../account/email/password_reset_subject.txt | 0 .../tests}/templates/account/email_confirm.html | 0 .../templates/account/email_confirmation_sent.html | 0 {tests => account/tests}/templates/account/login.html | 0 .../tests}/templates/account/logout.html | 0 .../tests}/templates/account/password_change.html | 0 .../tests}/templates/account/password_reset_sent.html | 0 .../templates/account/password_reset_token.html | 0 .../templates/account/password_reset_token_fail.html | 0 .../tests}/templates/account/settings.html | 0 .../tests}/templates/account/signup.html | 0 .../tests}/templates/account/signup_closed.html | 0 {tests => account/tests}/test_auth.py | 0 {tests => account/tests}/test_commands.py | 0 {tests => account/tests}/test_decorators.py | 0 {tests => account/tests}/test_email_address.py | 0 {tests => account/tests}/test_models.py | 0 {tests => account/tests}/test_password.py | 0 {tests => account/tests}/test_views.py | 0 {tests => account/tests}/urls.py | 0 makemigrations.py | 4 ++-- manage.py | 2 +- pyproject.toml | 11 ++++++++--- runtests.py | 4 ++-- 33 files changed, 16 insertions(+), 12 deletions(-) rename {tests => account/tests}/__init__.py (100%) rename {tests => account/tests}/settings.py (96%) rename {tests => account/tests}/templates/account/email/email_confirmation_message.txt (100%) rename {tests => account/tests}/templates/account/email/email_confirmation_subject.txt (100%) rename {tests => account/tests}/templates/account/email/password_change.txt (100%) rename {tests => account/tests}/templates/account/email/password_change_subject.txt (100%) rename {tests => account/tests}/templates/account/email/password_reset.txt (100%) rename {tests => account/tests}/templates/account/email/password_reset_subject.txt (100%) rename {tests => account/tests}/templates/account/email_confirm.html (100%) rename {tests => account/tests}/templates/account/email_confirmation_sent.html (100%) rename {tests => account/tests}/templates/account/login.html (100%) rename {tests => account/tests}/templates/account/logout.html (100%) rename {tests => account/tests}/templates/account/password_change.html (100%) rename {tests => account/tests}/templates/account/password_reset_sent.html (100%) rename {tests => account/tests}/templates/account/password_reset_token.html (100%) rename {tests => account/tests}/templates/account/password_reset_token_fail.html (100%) rename {tests => account/tests}/templates/account/settings.html (100%) rename {tests => account/tests}/templates/account/signup.html (100%) rename {tests => account/tests}/templates/account/signup_closed.html (100%) rename {tests => account/tests}/test_auth.py (100%) rename {tests => account/tests}/test_commands.py (100%) rename {tests => account/tests}/test_decorators.py (100%) rename {tests => account/tests}/test_email_address.py (100%) rename {tests => account/tests}/test_models.py (100%) rename {tests => account/tests}/test_password.py (100%) rename {tests => account/tests}/test_views.py (100%) rename {tests => account/tests}/urls.py (100%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d4900ace..837174bb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,7 +20,7 @@ jobs: - name: Lint with ruff run: | - ruff --format=github --target-version=py311 account tests + ruff --format=github --target-version=py311 account test: name: Testing diff --git a/MANIFEST.in b/MANIFEST.in index ee1f9ed9..79e1f602 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -9,6 +9,5 @@ recursive-include account/migrations *.py recursive-include docs *.rst exclude tox.ini recursive-exclude django_user_accounts.egg-info * -recursive-exclude tests * exclude docs/conf.py exclude docs/Makefile diff --git a/tests/__init__.py b/account/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to account/tests/__init__.py diff --git a/tests/settings.py b/account/tests/settings.py similarity index 96% rename from tests/settings.py rename to account/tests/settings.py index 386ad249..6ec3bbf8 100644 --- a/tests/settings.py +++ b/account/tests/settings.py @@ -7,7 +7,7 @@ "django.contrib.sites", "django.contrib.messages", "account", - "tests", + "account.tests", ] DATABASES = { "default": { @@ -16,7 +16,7 @@ } } SITE_ID = 1 -ROOT_URLCONF = "tests.urls" +ROOT_URLCONF = "account.tests.urls" SECRET_KEY = "notasecret" TEMPLATES = [ { diff --git a/tests/templates/account/email/email_confirmation_message.txt b/account/tests/templates/account/email/email_confirmation_message.txt similarity index 100% rename from tests/templates/account/email/email_confirmation_message.txt rename to account/tests/templates/account/email/email_confirmation_message.txt diff --git a/tests/templates/account/email/email_confirmation_subject.txt b/account/tests/templates/account/email/email_confirmation_subject.txt similarity index 100% rename from tests/templates/account/email/email_confirmation_subject.txt rename to account/tests/templates/account/email/email_confirmation_subject.txt diff --git a/tests/templates/account/email/password_change.txt b/account/tests/templates/account/email/password_change.txt similarity index 100% rename from tests/templates/account/email/password_change.txt rename to account/tests/templates/account/email/password_change.txt diff --git a/tests/templates/account/email/password_change_subject.txt b/account/tests/templates/account/email/password_change_subject.txt similarity index 100% rename from tests/templates/account/email/password_change_subject.txt rename to account/tests/templates/account/email/password_change_subject.txt diff --git a/tests/templates/account/email/password_reset.txt b/account/tests/templates/account/email/password_reset.txt similarity index 100% rename from tests/templates/account/email/password_reset.txt rename to account/tests/templates/account/email/password_reset.txt diff --git a/tests/templates/account/email/password_reset_subject.txt b/account/tests/templates/account/email/password_reset_subject.txt similarity index 100% rename from tests/templates/account/email/password_reset_subject.txt rename to account/tests/templates/account/email/password_reset_subject.txt diff --git a/tests/templates/account/email_confirm.html b/account/tests/templates/account/email_confirm.html similarity index 100% rename from tests/templates/account/email_confirm.html rename to account/tests/templates/account/email_confirm.html diff --git a/tests/templates/account/email_confirmation_sent.html b/account/tests/templates/account/email_confirmation_sent.html similarity index 100% rename from tests/templates/account/email_confirmation_sent.html rename to account/tests/templates/account/email_confirmation_sent.html diff --git a/tests/templates/account/login.html b/account/tests/templates/account/login.html similarity index 100% rename from tests/templates/account/login.html rename to account/tests/templates/account/login.html diff --git a/tests/templates/account/logout.html b/account/tests/templates/account/logout.html similarity index 100% rename from tests/templates/account/logout.html rename to account/tests/templates/account/logout.html diff --git a/tests/templates/account/password_change.html b/account/tests/templates/account/password_change.html similarity index 100% rename from tests/templates/account/password_change.html rename to account/tests/templates/account/password_change.html diff --git a/tests/templates/account/password_reset_sent.html b/account/tests/templates/account/password_reset_sent.html similarity index 100% rename from tests/templates/account/password_reset_sent.html rename to account/tests/templates/account/password_reset_sent.html diff --git a/tests/templates/account/password_reset_token.html b/account/tests/templates/account/password_reset_token.html similarity index 100% rename from tests/templates/account/password_reset_token.html rename to account/tests/templates/account/password_reset_token.html diff --git a/tests/templates/account/password_reset_token_fail.html b/account/tests/templates/account/password_reset_token_fail.html similarity index 100% rename from tests/templates/account/password_reset_token_fail.html rename to account/tests/templates/account/password_reset_token_fail.html diff --git a/tests/templates/account/settings.html b/account/tests/templates/account/settings.html similarity index 100% rename from tests/templates/account/settings.html rename to account/tests/templates/account/settings.html diff --git a/tests/templates/account/signup.html b/account/tests/templates/account/signup.html similarity index 100% rename from tests/templates/account/signup.html rename to account/tests/templates/account/signup.html diff --git a/tests/templates/account/signup_closed.html b/account/tests/templates/account/signup_closed.html similarity index 100% rename from tests/templates/account/signup_closed.html rename to account/tests/templates/account/signup_closed.html diff --git a/tests/test_auth.py b/account/tests/test_auth.py similarity index 100% rename from tests/test_auth.py rename to account/tests/test_auth.py diff --git a/tests/test_commands.py b/account/tests/test_commands.py similarity index 100% rename from tests/test_commands.py rename to account/tests/test_commands.py diff --git a/tests/test_decorators.py b/account/tests/test_decorators.py similarity index 100% rename from tests/test_decorators.py rename to account/tests/test_decorators.py diff --git a/tests/test_email_address.py b/account/tests/test_email_address.py similarity index 100% rename from tests/test_email_address.py rename to account/tests/test_email_address.py diff --git a/tests/test_models.py b/account/tests/test_models.py similarity index 100% rename from tests/test_models.py rename to account/tests/test_models.py diff --git a/tests/test_password.py b/account/tests/test_password.py similarity index 100% rename from tests/test_password.py rename to account/tests/test_password.py diff --git a/tests/test_views.py b/account/tests/test_views.py similarity index 100% rename from tests/test_views.py rename to account/tests/test_views.py diff --git a/tests/urls.py b/account/tests/urls.py similarity index 100% rename from tests/urls.py rename to account/tests/urls.py diff --git a/makemigrations.py b/makemigrations.py index 894b4d75..eb2aa60d 100644 --- a/makemigrations.py +++ b/makemigrations.py @@ -11,7 +11,7 @@ "django.contrib.contenttypes", "django.contrib.sites", "account", - "tests" + "account.tests" ], MIDDLEWARE_CLASSES=[], DATABASES={ @@ -21,7 +21,7 @@ } }, SITE_ID=1, - ROOT_URLCONF="tests.urls", + ROOT_URLCONF="account.tests.urls", SECRET_KEY="notasecret", ) diff --git a/manage.py b/manage.py index dc935d61..646bf7ab 100644 --- a/manage.py +++ b/manage.py @@ -3,7 +3,7 @@ import sys if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "account.tests.settings") from django.core.management import execute_from_command_line diff --git a/pyproject.toml b/pyproject.toml index cdb037a4..ef886100 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,8 +47,8 @@ skip_glob = "account/migrations/*,docs" include_trailing_comma = "True" [tool.pytest.ini_options] -testpaths = ["tests"] -DJANGO_SETTINGS_MODULE = "tests.settings" +testpaths = ["account/tests"] +DJANGO_SETTINGS_MODULE = "account.tests.settings" [tool.ruff] line-length = 120 @@ -57,7 +57,12 @@ line-length = 120 "account/migrations/**.py" = ["E501"] [tool.setuptools] -packages = ["account"] +package-dir = {"" = "."} +include-package-data = true +zip-safe = false [tool.setuptools.dynamic] version = {attr = "account.__version__"} + +[tool.setuptools.package-data] +account = ["locale/*/LC_MESSAGES/*"] diff --git a/runtests.py b/runtests.py index 1eb34476..5a60937d 100644 --- a/runtests.py +++ b/runtests.py @@ -6,7 +6,7 @@ def runtests(*test_args): - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "account.tests.settings") django.setup() parent = os.path.dirname(os.path.abspath(__file__)) @@ -15,7 +15,7 @@ def runtests(*test_args): from django.test.runner import DiscoverRunner runner_class = DiscoverRunner if not test_args: - test_args = ["tests"] + test_args = ["account/tests"] failures = runner_class(verbosity=1, interactive=True, failfast=False).run_tests(test_args) sys.exit(failures) From 714c307e36af406783ad8a80cecf795206cc389d Mon Sep 17 00:00:00 2001 From: blag Date: Fri, 8 Sep 2023 15:33:00 -0700 Subject: [PATCH 4/5] Configure DeepSource to ignore test files --- .deepsource.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.deepsource.toml b/.deepsource.toml index 2783c4df..9e84a0db 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -3,7 +3,8 @@ version = 1 exclude_patterns = [ "makemigrations.py", "runtests.py", - "tests/**", + "account/tests/**", + "account/tests/test_*.py", ] [[analyzers]] From b79d26e0c45e309166c8a19c8e6f18eeb32616c0 Mon Sep 17 00:00:00 2001 From: blag Date: Fri, 8 Sep 2023 16:01:05 -0700 Subject: [PATCH 5/5] Use runtests.py in GHA --- .github/workflows/ci.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 837174bb..0cc1bb37 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,10 +51,6 @@ jobs: shell: bash run: pip install Django==${{ matrix.django }} 'django-appconf>=1.0.4' 'pytz>=2020.4' - - name: Install test utilities - shell: bash - run: pip install pytest pytest-django - - name: Running Python Tests shell: bash - run: pytest + run: python3 runtests.py