diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 57f8266d..d6319d3f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: rev: 6.1.0 hooks: - id: flake8 - exclude: migrations/|.*settings(\.py|/)? + exclude: migrations/|config/|.*settings(\.py|/)? additional_dependencies: - flake8-isort - flake8-django @@ -41,4 +41,4 @@ repos: language: system pass_filenames: false entry: poetry export --without-hashes --output requirements/production.txt - files: ^(pyproject.toml|poetry.lock)$ \ No newline at end of file + files: ^(pyproject.toml|poetry.lock)$ diff --git a/Makefile b/Makefile index 7a7cf967..91f8f0b1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # Определение переменных PROJECT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) MANAGE_DIR := $(PROJECT_DIR)/adaptive_hockey_federation/manage.py +DJANGO_DIR := $(PROJECT_DIR)/adaptive_hockey_federation POETRY_RUN := poetry run python DJANGO_RUN := $(POETRY_RUN) $(MANAGE_DIR) SHELL_GREEN = \033[32m @@ -22,6 +23,7 @@ help: @echo " createsuperuser - $(SHELL_GREEN)Команда для создания супер-юзера.$(SHELL_NC)" @echo " run - $(SHELL_GREEN)Команда для локального запуска проекта.$(SHELL_NC)" @echo " fill-db - $(SHELL_GREEN)Команда для заполнения базы данных с помощью парсера.$(SHELL_NC)" + @echo " pytest - $(SHELL_GREEN)Команда для прогона юнит тестов pytest.$(SHELL_NC)" @echo " help - $(SHELL_GREEN)Команда вызова справки.$(SHELL_NC)" @echo "$(SHELL_YELLOW)Для запуска исполнения команд используйте данные ключи совместно с командой 'make', например 'make init-app'." @echo "При запуске команды 'make' без какого либо ключа, происходит вызов справки.$(SHELL_NC)" @@ -61,4 +63,9 @@ run: fill-db: cd $(PROJECT_DIR) && $(DJANGO_RUN) fill-db +# Прогон тестов с помощью pytest +pytest: + cd $(DJANGO_DIR) && pytest + + .PHONY: help diff --git a/adaptive_hockey_federation/adaptive_hockey_federation/asgi.py b/adaptive_hockey_federation/core/asgi.py similarity index 78% rename from adaptive_hockey_federation/adaptive_hockey_federation/asgi.py rename to adaptive_hockey_federation/core/asgi.py index 71988678..b775b189 100644 --- a/adaptive_hockey_federation/adaptive_hockey_federation/asgi.py +++ b/adaptive_hockey_federation/core/asgi.py @@ -4,7 +4,7 @@ os.environ.setdefault( 'DJANGO_SETTINGS_MODULE', - 'adaptive_hockey_federation.settings' + 'core.config.dev_settings', ) application = get_asgi_application() diff --git a/adaptive_hockey_federation/adaptive_hockey_federation/__init__.py b/adaptive_hockey_federation/core/config/base_settings.py similarity index 100% rename from adaptive_hockey_federation/adaptive_hockey_federation/__init__.py rename to adaptive_hockey_federation/core/config/base_settings.py diff --git a/adaptive_hockey_federation/adaptive_hockey_federation/settings.py b/adaptive_hockey_federation/core/config/dev_settings.py similarity index 94% rename from adaptive_hockey_federation/adaptive_hockey_federation/settings.py rename to adaptive_hockey_federation/core/config/dev_settings.py index 2fc2b806..ad56215c 100644 --- a/adaptive_hockey_federation/adaptive_hockey_federation/settings.py +++ b/adaptive_hockey_federation/core/config/dev_settings.py @@ -3,7 +3,7 @@ # import environ -BASE_DIR = Path(__file__).resolve().parent.parent +BASE_DIR = Path(__file__).resolve().parent.parent.parent # env = environ.Env(DEBUG=(bool, False)) @@ -39,7 +39,7 @@ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] -ROOT_URLCONF = 'adaptive_hockey_federation.urls' +ROOT_URLCONF = 'core.urls' TEMPLATES_DIR = BASE_DIR / 'templates' @@ -59,7 +59,7 @@ }, ] -WSGI_APPLICATION = 'adaptive_hockey_federation.wsgi.application' +WSGI_APPLICATION = 'core.wsgi.application' DATABASES = { 'default': { diff --git a/adaptive_hockey_federation/core/config/prod_settings.py b/adaptive_hockey_federation/core/config/prod_settings.py new file mode 100644 index 00000000..e69de29b diff --git a/adaptive_hockey_federation/core/config/test_settings.py b/adaptive_hockey_federation/core/config/test_settings.py new file mode 100644 index 00000000..e69de29b diff --git a/adaptive_hockey_federation/core/management/commands/fill-db.py b/adaptive_hockey_federation/core/management/commands/fill-db.py index 89439ee9..413904f8 100644 --- a/adaptive_hockey_federation/core/management/commands/fill-db.py +++ b/adaptive_hockey_federation/core/management/commands/fill-db.py @@ -2,7 +2,7 @@ from django.core.management.base import BaseCommand -from adaptive_hockey_federation.settings import RESOURSES_ROOT +from adaptive_hockey_federation.core.config.dev_settings import RESOURSES_ROOT class Command(BaseCommand): diff --git a/adaptive_hockey_federation/adaptive_hockey_federation/urls.py b/adaptive_hockey_federation/core/urls.py similarity index 100% rename from adaptive_hockey_federation/adaptive_hockey_federation/urls.py rename to adaptive_hockey_federation/core/urls.py diff --git a/adaptive_hockey_federation/adaptive_hockey_federation/wsgi.py b/adaptive_hockey_federation/core/wsgi.py similarity index 78% rename from adaptive_hockey_federation/adaptive_hockey_federation/wsgi.py rename to adaptive_hockey_federation/core/wsgi.py index 5328e2bd..6544fefc 100644 --- a/adaptive_hockey_federation/adaptive_hockey_federation/wsgi.py +++ b/adaptive_hockey_federation/core/wsgi.py @@ -4,7 +4,7 @@ os.environ.setdefault( 'DJANGO_SETTINGS_MODULE', - 'adaptive_hockey_federation.settings' + 'core.config.dev_settings', ) application = get_wsgi_application() diff --git a/adaptive_hockey_federation/main/migrations/0003_alter_player_patronymic.py b/adaptive_hockey_federation/main/migrations/0003_alter_player_patronymic.py new file mode 100644 index 00000000..aacc2004 --- /dev/null +++ b/adaptive_hockey_federation/main/migrations/0003_alter_player_patronymic.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.8 on 2023-12-16 13:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0002_alter_player_patronymic'), + ] + + operations = [ + migrations.AlterField( + model_name='player', + name='patronymic', + field=models.CharField(blank=True, default='--пусто--', help_text='Отчество', max_length=256, verbose_name='Отчество'), + ), + ] diff --git a/adaptive_hockey_federation/manage.py b/adaptive_hockey_federation/manage.py index 74086011..cf3ce1f1 100644 --- a/adaptive_hockey_federation/manage.py +++ b/adaptive_hockey_federation/manage.py @@ -7,7 +7,7 @@ def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', - 'adaptive_hockey_federation.settings') + 'core.config.dev_settings') try: from django.core.management import execute_from_command_line except ImportError as exc: diff --git a/adaptive_hockey_federation/parser/docx_parser.py b/adaptive_hockey_federation/parser/docx_parser.py index b2bea2e4..09938e4d 100644 --- a/adaptive_hockey_federation/parser/docx_parser.py +++ b/adaptive_hockey_federation/parser/docx_parser.py @@ -4,7 +4,7 @@ import docx # type: ignore -from adaptive_hockey_federation.core.user_card import BaseUserInfo +from adaptive_hockey_federation.parser.user_card import BaseUserInfo NAME = '[И|и][М|м][Я|я]' SURNAME = '[Ф|ф][А|а][М|м][И|и][Л|л][И|и][Я|я]' diff --git a/adaptive_hockey_federation/core/user_card.py b/adaptive_hockey_federation/parser/user_card.py similarity index 100% rename from adaptive_hockey_federation/core/user_card.py rename to adaptive_hockey_federation/parser/user_card.py diff --git a/adaptive_hockey_federation/parser/xlsx_parser.py b/adaptive_hockey_federation/parser/xlsx_parser.py index 7df943aa..bc20974d 100644 --- a/adaptive_hockey_federation/parser/xlsx_parser.py +++ b/adaptive_hockey_federation/parser/xlsx_parser.py @@ -1,6 +1,6 @@ import openpyxl -from adaptive_hockey_federation.core.user_card import BaseUserInfo +from adaptive_hockey_federation.parser.user_card import BaseUserInfo def xlsx_parser(path: str) -> list[BaseUserInfo]: diff --git a/entrypoint.sh b/entrypoint.sh index 95c2b12b..4c61f440 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,4 +4,4 @@ sleep 5 app/.venv/bin/python manage.py collectstatic --noinput mv /static/* /app/static/ -exec "$@" \ No newline at end of file +exec "$@" diff --git a/poetry.lock b/poetry.lock index 3c0e68e6..d1033fdf 100644 --- a/poetry.lock +++ b/poetry.lock @@ -31,13 +31,13 @@ wrapt = {version = ">=1.14,<2", markers = "python_version >= \"3.11\""} [[package]] name = "certifi" -version = "2023.7.22" +version = "2023.11.17" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, - {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, + {file = "certifi-2023.11.17-py3-none-any.whl", hash = "sha256:e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474"}, + {file = "certifi-2023.11.17.tar.gz", hash = "sha256:9b469f3a900bf28dc19b8cfbf8019bf47f7fdd1a65a1d4ffb98fc14166beb4d1"}, ] [[package]] @@ -177,24 +177,24 @@ files = [ [[package]] name = "distlib" -version = "0.3.7" +version = "0.3.8" description = "Distribution utilities" optional = false python-versions = "*" files = [ - {file = "distlib-0.3.7-py2.py3-none-any.whl", hash = "sha256:2e24928bc811348f0feb63014e97aaae3037f2cf48712d51ae61df7fd6075057"}, - {file = "distlib-0.3.7.tar.gz", hash = "sha256:9dafe54b34a028eafd95039d5e5d4851a13734540f1331060d31c9916e7147a8"}, + {file = "distlib-0.3.8-py2.py3-none-any.whl", hash = "sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784"}, + {file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"}, ] [[package]] name = "django" -version = "4.2.7" +version = "4.2.8" description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." optional = false python-versions = ">=3.8" files = [ - {file = "Django-4.2.7-py3-none-any.whl", hash = "sha256:e1d37c51ad26186de355cbcec16613ebdabfa9689bbade9c538835205a8abbe9"}, - {file = "Django-4.2.7.tar.gz", hash = "sha256:8e0f1c2c2786b5c0e39fe1afce24c926040fad47c8ea8ad30aaf1188df29fc41"}, + {file = "Django-4.2.8-py3-none-any.whl", hash = "sha256:6cb5dcea9e3d12c47834d32156b8841f533a4493c688e2718cafd51aa430ba6d"}, + {file = "Django-4.2.8.tar.gz", hash = "sha256:d69d5e36cc5d9f4eb4872be36c622878afcdce94062716cf3e25bcedcb168b62"}, ] [package.dependencies] @@ -208,35 +208,34 @@ bcrypt = ["bcrypt"] [[package]] name = "django-stubs" -version = "4.2.4" +version = "4.2.7" description = "Mypy stubs for Django" optional = false python-versions = ">=3.8" files = [ - {file = "django-stubs-4.2.4.tar.gz", hash = "sha256:7d4a132c381519815e865c27a89eca41bcbd06056832507224816a43d75c601c"}, - {file = "django_stubs-4.2.4-py3-none-any.whl", hash = "sha256:834b60fd81510cce6b56c1c6c28bec3c504a418bc90ff7d0063fabe8ab9a7868"}, + {file = "django-stubs-4.2.7.tar.gz", hash = "sha256:8ccd2ff4ee5adf22b9e3b7b1a516d2e1c2191e9d94e672c35cc2bc3dd61e0f6b"}, + {file = "django_stubs-4.2.7-py3-none-any.whl", hash = "sha256:4cf4de258fa71adc6f2799e983091b9d46cfc67c6eebc68fe111218c9a62b3b8"}, ] [package.dependencies] django = "*" -django-stubs-ext = ">=4.2.2" -mypy = ">=1.0.0" +django-stubs-ext = ">=4.2.7" types-pytz = "*" types-PyYAML = "*" typing-extensions = "*" [package.extras] -compatible-mypy = ["mypy (==1.5.*)"] +compatible-mypy = ["mypy (>=1.7.0,<1.8.0)"] [[package]] name = "django-stubs-ext" -version = "4.2.2" +version = "4.2.7" description = "Monkey-patching and extensions for django-stubs" optional = false python-versions = ">=3.8" files = [ - {file = "django-stubs-ext-4.2.2.tar.gz", hash = "sha256:c69d1cc46f1c4c3b7894b685a5022c29b2a36c7cfb52e23762eaf357ebfc2c98"}, - {file = "django_stubs_ext-4.2.2-py3-none-any.whl", hash = "sha256:fdacc65a14d2d4b97334b58ff178a5853ec8c8c76cec406e417916ad67536ce4"}, + {file = "django-stubs-ext-4.2.7.tar.gz", hash = "sha256:519342ac0849cda1559746c9a563f03ff99f636b0ebe7c14b75e816a00dfddc3"}, + {file = "django_stubs_ext-4.2.7-py3-none-any.whl", hash = "sha256:45a5d102417a412e3606e3c358adb4744988a92b7b58ccf3fd64bddd5d04d14c"}, ] [package.dependencies] @@ -302,12 +301,13 @@ flake8 = ">=3.8.4,<7" [[package]] name = "flake8-isort" -version = "6.1.0" -description = "flake8 plugin that integrates isort ." +version = "6.1.1" +description = "flake8 plugin that integrates isort" optional = false python-versions = ">=3.8" files = [ - {file = "flake8-isort-6.1.0.tar.gz", hash = "sha256:d4639343bac540194c59fb1618ac2c285b3e27609f353bef6f50904d40c1643e"}, + {file = "flake8_isort-6.1.1-py3-none-any.whl", hash = "sha256:0fec4dc3a15aefbdbe4012e51d5531a2eb5fa8b981cdfbc882296a59b54ede12"}, + {file = "flake8_isort-6.1.1.tar.gz", hash = "sha256:c1f82f3cf06a80c13e1d09bfae460e9666255d5c780b859f19f8318d420370b3"}, ] [package.dependencies] @@ -353,31 +353,39 @@ license = ["ukkonen"] [[package]] name = "idna" -version = "3.4" +version = "3.6" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.5" files = [ - {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, - {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, + {file = "idna-3.6-py3-none-any.whl", hash = "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"}, + {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"}, +] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, ] [[package]] name = "isort" -version = "5.12.0" +version = "5.13.2" description = "A Python utility / library to sort Python imports." optional = false python-versions = ">=3.8.0" files = [ - {file = "isort-5.12.0-py3-none-any.whl", hash = "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"}, - {file = "isort-5.12.0.tar.gz", hash = "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504"}, + {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, + {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, ] [package.extras] -colors = ["colorama (>=0.4.3)"] -pipfile-deprecated-finder = ["pip-shims (>=0.5.2)", "pipreqs", "requirementslib"] -plugins = ["setuptools"] -requirements-deprecated-finder = ["pip-api", "pipreqs"] +colors = ["colorama (>=0.4.6)"] [[package]] name = "lazy-object-proxy" @@ -544,38 +552,38 @@ files = [ [[package]] name = "mypy" -version = "1.6.0" +version = "1.7.1" description = "Optional static typing for Python" optional = false python-versions = ">=3.8" files = [ - {file = "mypy-1.6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:091f53ff88cb093dcc33c29eee522c087a438df65eb92acd371161c1f4380ff0"}, - {file = "mypy-1.6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:eb7ff4007865833c470a601498ba30462b7374342580e2346bf7884557e40531"}, - {file = "mypy-1.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:49499cf1e464f533fc45be54d20a6351a312f96ae7892d8e9f1708140e27ce41"}, - {file = "mypy-1.6.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:4c192445899c69f07874dabda7e931b0cc811ea055bf82c1ababf358b9b2a72c"}, - {file = "mypy-1.6.0-cp310-cp310-win_amd64.whl", hash = "sha256:3df87094028e52766b0a59a3e46481bb98b27986ed6ded6a6cc35ecc75bb9182"}, - {file = "mypy-1.6.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3c8835a07b8442da900db47ccfda76c92c69c3a575872a5b764332c4bacb5a0a"}, - {file = "mypy-1.6.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:24f3de8b9e7021cd794ad9dfbf2e9fe3f069ff5e28cb57af6f873ffec1cb0425"}, - {file = "mypy-1.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:856bad61ebc7d21dbc019b719e98303dc6256cec6dcc9ebb0b214b81d6901bd8"}, - {file = "mypy-1.6.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:89513ddfda06b5c8ebd64f026d20a61ef264e89125dc82633f3c34eeb50e7d60"}, - {file = "mypy-1.6.0-cp311-cp311-win_amd64.whl", hash = "sha256:9f8464ed410ada641c29f5de3e6716cbdd4f460b31cf755b2af52f2d5ea79ead"}, - {file = "mypy-1.6.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:971104bcb180e4fed0d7bd85504c9036346ab44b7416c75dd93b5c8c6bb7e28f"}, - {file = "mypy-1.6.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ab98b8f6fdf669711f3abe83a745f67f50e3cbaea3998b90e8608d2b459fd566"}, - {file = "mypy-1.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1a69db3018b87b3e6e9dd28970f983ea6c933800c9edf8c503c3135b3274d5ad"}, - {file = "mypy-1.6.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:dccd850a2e3863891871c9e16c54c742dba5470f5120ffed8152956e9e0a5e13"}, - {file = "mypy-1.6.0-cp312-cp312-win_amd64.whl", hash = "sha256:f8598307150b5722854f035d2e70a1ad9cc3c72d392c34fffd8c66d888c90f17"}, - {file = "mypy-1.6.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:fea451a3125bf0bfe716e5d7ad4b92033c471e4b5b3e154c67525539d14dc15a"}, - {file = "mypy-1.6.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e28d7b221898c401494f3b77db3bac78a03ad0a0fff29a950317d87885c655d2"}, - {file = "mypy-1.6.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e4b7a99275a61aa22256bab5839c35fe8a6887781862471df82afb4b445daae6"}, - {file = "mypy-1.6.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:7469545380dddce5719e3656b80bdfbb217cfe8dbb1438532d6abc754b828fed"}, - {file = "mypy-1.6.0-cp38-cp38-win_amd64.whl", hash = "sha256:7807a2a61e636af9ca247ba8494031fb060a0a744b9fee7de3a54bed8a753323"}, - {file = "mypy-1.6.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d2dad072e01764823d4b2f06bc7365bb1d4b6c2f38c4d42fade3c8d45b0b4b67"}, - {file = "mypy-1.6.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b19006055dde8a5425baa5f3b57a19fa79df621606540493e5e893500148c72f"}, - {file = "mypy-1.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:31eba8a7a71f0071f55227a8057468b8d2eb5bf578c8502c7f01abaec8141b2f"}, - {file = "mypy-1.6.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8e0db37ac4ebb2fee7702767dfc1b773c7365731c22787cb99f507285014fcaf"}, - {file = "mypy-1.6.0-cp39-cp39-win_amd64.whl", hash = "sha256:c69051274762cccd13498b568ed2430f8d22baa4b179911ad0c1577d336ed849"}, - {file = "mypy-1.6.0-py3-none-any.whl", hash = "sha256:9e1589ca150a51d9d00bb839bfeca2f7a04f32cd62fad87a847bc0818e15d7dc"}, - {file = "mypy-1.6.0.tar.gz", hash = "sha256:4f3d27537abde1be6d5f2c96c29a454da333a2a271ae7d5bc7110e6d4b7beb3f"}, + {file = "mypy-1.7.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:12cce78e329838d70a204293e7b29af9faa3ab14899aec397798a4b41be7f340"}, + {file = "mypy-1.7.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1484b8fa2c10adf4474f016e09d7a159602f3239075c7bf9f1627f5acf40ad49"}, + {file = "mypy-1.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:31902408f4bf54108bbfb2e35369877c01c95adc6192958684473658c322c8a5"}, + {file = "mypy-1.7.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f2c2521a8e4d6d769e3234350ba7b65ff5d527137cdcde13ff4d99114b0c8e7d"}, + {file = "mypy-1.7.1-cp310-cp310-win_amd64.whl", hash = "sha256:fcd2572dd4519e8a6642b733cd3a8cfc1ef94bafd0c1ceed9c94fe736cb65b6a"}, + {file = "mypy-1.7.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4b901927f16224d0d143b925ce9a4e6b3a758010673eeded9b748f250cf4e8f7"}, + {file = "mypy-1.7.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2f7f6985d05a4e3ce8255396df363046c28bea790e40617654e91ed580ca7c51"}, + {file = "mypy-1.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:944bdc21ebd620eafefc090cdf83158393ec2b1391578359776c00de00e8907a"}, + {file = "mypy-1.7.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9c7ac372232c928fff0645d85f273a726970c014749b924ce5710d7d89763a28"}, + {file = "mypy-1.7.1-cp311-cp311-win_amd64.whl", hash = "sha256:f6efc9bd72258f89a3816e3a98c09d36f079c223aa345c659622f056b760ab42"}, + {file = "mypy-1.7.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:6dbdec441c60699288adf051f51a5d512b0d818526d1dcfff5a41f8cd8b4aaf1"}, + {file = "mypy-1.7.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4fc3d14ee80cd22367caaaf6e014494415bf440980a3045bf5045b525680ac33"}, + {file = "mypy-1.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c6e4464ed5f01dc44dc9821caf67b60a4e5c3b04278286a85c067010653a0eb"}, + {file = "mypy-1.7.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:d9b338c19fa2412f76e17525c1b4f2c687a55b156320acb588df79f2e6fa9fea"}, + {file = "mypy-1.7.1-cp312-cp312-win_amd64.whl", hash = "sha256:204e0d6de5fd2317394a4eff62065614c4892d5a4d1a7ee55b765d7a3d9e3f82"}, + {file = "mypy-1.7.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:84860e06ba363d9c0eeabd45ac0fde4b903ad7aa4f93cd8b648385a888e23200"}, + {file = "mypy-1.7.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8c5091ebd294f7628eb25ea554852a52058ac81472c921150e3a61cdd68f75a7"}, + {file = "mypy-1.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40716d1f821b89838589e5b3106ebbc23636ffdef5abc31f7cd0266db936067e"}, + {file = "mypy-1.7.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5cf3f0c5ac72139797953bd50bc6c95ac13075e62dbfcc923571180bebb662e9"}, + {file = "mypy-1.7.1-cp38-cp38-win_amd64.whl", hash = "sha256:78e25b2fd6cbb55ddfb8058417df193f0129cad5f4ee75d1502248e588d9e0d7"}, + {file = "mypy-1.7.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:75c4d2a6effd015786c87774e04331b6da863fc3fc4e8adfc3b40aa55ab516fe"}, + {file = "mypy-1.7.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:2643d145af5292ee956aa0a83c2ce1038a3bdb26e033dadeb2f7066fb0c9abce"}, + {file = "mypy-1.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:75aa828610b67462ffe3057d4d8a4112105ed211596b750b53cbfe182f44777a"}, + {file = "mypy-1.7.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ee5d62d28b854eb61889cde4e1dbc10fbaa5560cb39780c3995f6737f7e82120"}, + {file = "mypy-1.7.1-cp39-cp39-win_amd64.whl", hash = "sha256:72cf32ce7dd3562373f78bd751f73c96cfb441de147cc2448a92c1a308bd0ca6"}, + {file = "mypy-1.7.1-py3-none-any.whl", hash = "sha256:f7c5d642db47376a0cc130f0de6d055056e010debdaf0707cd2b0fc7e7ef30ea"}, + {file = "mypy-1.7.1.tar.gz", hash = "sha256:fcb6d9afb1b6208b4c712af0dafdc650f518836065df0d4fb1d800f5d6773db2"}, ] [package.dependencies] @@ -585,6 +593,7 @@ typing-extensions = ">=4.1.0" [package.extras] dmypy = ["psutil (>=4.0)"] install-types = ["pip"] +mypyc = ["setuptools (>=50)"] reports = ["lxml"] [[package]] @@ -668,6 +677,21 @@ files = [ docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.1)", "sphinx-autodoc-typehints (>=1.24)"] test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)"] +[[package]] +name = "pluggy" +version = "1.3.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, + {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + [[package]] name = "pre-commit" version = "3.5.0" @@ -708,6 +732,44 @@ files = [ {file = "pyflakes-3.1.0.tar.gz", hash = "sha256:a0aae034c444db0071aa077972ba4768d40c830d9539fd45bf4cd3f8f6992efc"}, ] +[[package]] +name = "pytest" +version = "7.4.3" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.4.3-py3-none-any.whl", hash = "sha256:0d009c083ea859a71b76adf7c1d502e4bc170b80a8ef002da5806527b9591fac"}, + {file = "pytest-7.4.3.tar.gz", hash = "sha256:d989d136982de4e3b29dabcc838ad581c64e8ed52c11fbe86ddebd9da0818cd5"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "pytest-django" +version = "4.7.0" +description = "A Django plugin for pytest." +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest-django-4.7.0.tar.gz", hash = "sha256:92d6fd46b1d79b54fb6b060bbb39428073396cec717d5f2e122a990d4b6aa5e8"}, + {file = "pytest_django-4.7.0-py3-none-any.whl", hash = "sha256:4e1c79d5261ade2dd58d91208017cd8f62cb4710b56e012ecd361d15d5d662a2"}, +] + +[package.dependencies] +pytest = ">=7.0.0" + +[package.extras] +docs = ["sphinx", "sphinx-rtd-theme"] +testing = ["Django", "django-configurations (>=2.0)"] + [[package]] name = "python-docx" version = "1.1.0" @@ -837,13 +899,13 @@ test = ["pytest", "pytest-cov"] [[package]] name = "types-openpyxl" -version = "3.1.0.27" +version = "3.1.0.32" description = "Typing stubs for openpyxl" optional = false python-versions = ">=3.7" files = [ - {file = "types-openpyxl-3.1.0.27.tar.gz", hash = "sha256:1498a9b55965df2d91a46ea65698f60bc3a44e1151875497835a387e3d1de6e4"}, - {file = "types_openpyxl-3.1.0.27-py3-none-any.whl", hash = "sha256:e580b49e7682589d25f49b3df84afaeafbc9715b64cf163a2e1ba45955fe0357"}, + {file = "types-openpyxl-3.1.0.32.tar.gz", hash = "sha256:3d37da6490fc4ed04f1d79c0f523b31197d559043cbc90cbd15acab542a0267b"}, + {file = "types_openpyxl-3.1.0.32-py3-none-any.whl", hash = "sha256:d347f177783dde0f3970aa4a32f808932a269f93809aa953a2bf33bc92b25eb1"}, ] [[package]] @@ -870,13 +932,13 @@ files = [ [[package]] name = "typing-extensions" -version = "4.8.0" +version = "4.9.0" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.8.0-py3-none-any.whl", hash = "sha256:8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0"}, - {file = "typing_extensions-4.8.0.tar.gz", hash = "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef"}, + {file = "typing_extensions-4.9.0-py3-none-any.whl", hash = "sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd"}, + {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"}, ] [[package]] @@ -892,18 +954,17 @@ files = [ [[package]] name = "urllib3" -version = "2.0.7" +version = "2.1.0" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "urllib3-2.0.7-py3-none-any.whl", hash = "sha256:fdb6d215c776278489906c2f8916e6e7d4f5a9b602ccbcfdf7f016fc8da0596e"}, - {file = "urllib3-2.0.7.tar.gz", hash = "sha256:c97dfde1f7bd43a71c8d2a58e369e9b2bf692d1334ea9f9cae55add7d0dd0f84"}, + {file = "urllib3-2.1.0-py3-none-any.whl", hash = "sha256:55901e917a5896a349ff771be919f8bd99aff50b79fe58fec595eb37bbc56bb3"}, + {file = "urllib3-2.1.0.tar.gz", hash = "sha256:df7aa8afb0148fa78488e7899b2c59b5f4ffcfa82e6c54ccb9dd37c1d7b52d54"}, ] [package.extras] brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] -secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] @@ -1009,4 +1070,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "f237815c587070334308524ad0eb91285d7290f76e985ecd665a53da2d654b21" \ No newline at end of file +content-hash = "33b15b5351144984f9c4eddf307c221188b055f0aa4a258a6b5ea7f80124339e" diff --git a/pyproject.toml b/pyproject.toml index ee49b7fa..40a6f67e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ types-openpyxl = "^3.1.0.24" openpyxl-stubs = "^0.1.25" click = "^8.1.7" wrapt = "^1.16.0" +pytest-django = "^4.7.0" [tool.poetry.group.dev.dependencies] isort = "^5.12.0" @@ -49,15 +50,20 @@ mypy_path = "./adaptive_hockey_federation" [[tool.mypy.overrides]] module = [ - "adaptive_hockey_federation.core.user_card", + "adaptive_hockey_federation.parser.user_card", "adaptive_hockey_federation.parser.*", + "adaptive_hockey_federation.core.config.dev_settings", ] ignore_missing_imports = true [tool.django-stubs] -django_settings_module = "adaptive_hockey_federation.settings" +django_settings_module = "adaptive_hockey_federation.core.config.dev_settings" [tool.poetry.scripts] -parser = "adaptive_hockey_federation.parser.parser:parsing_file" \ No newline at end of file +parser = "adaptive_hockey_federation.parser.parser:parsing_file" + +[tool.pytest.ini_options] +DJANGO_SETTINGS_MODULE = "adaptive_hockey_federation.core.config.test_settings" +python_files = ["test_*.py"] diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..0e4b929c --- /dev/null +++ b/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +python_paths = adaptive_hockey_federation/ +DJANGO_SETTINGS_MODULE = core.config.test_settings +testpaths = tests/ +python_files = test_*.py diff --git a/requirements/develop.txt b/requirements/develop.txt index 76ea2b31..277859c6 100644 --- a/requirements/develop.txt +++ b/requirements/develop.txt @@ -1,27 +1,31 @@ asgiref==3.7.2 ; python_version >= "3.11" and python_version < "4.0" cfgv==3.4.0 ; python_version >= "3.11" and python_version < "4.0" click==8.1.7 ; python_version >= "3.11" and python_version < "4.0" -colorama==0.4.6 ; python_version >= "3.11" and python_version < "4.0" and platform_system == "Windows" -distlib==0.3.7 ; python_version >= "3.11" and python_version < "4.0" -django==4.2.7 ; python_version >= "3.11" and python_version < "4.0" +colorama==0.4.6 ; python_version >= "3.11" and python_version < "4.0" and (platform_system == "Windows" or sys_platform == "win32") +distlib==0.3.8 ; python_version >= "3.11" and python_version < "4.0" +django==4.2.8 ; python_version >= "3.11" and python_version < "4.0" et-xmlfile==1.1.0 ; python_version >= "3.11" and python_version < "4.0" filelock==3.13.1 ; python_version >= "3.11" and python_version < "4.0" gunicorn==21.2.0 ; python_version >= "3.11" and python_version < "4.0" identify==2.5.33 ; python_version >= "3.11" and python_version < "4.0" -isort==5.12.0 ; python_version >= "3.11" and python_version < "4.0" +iniconfig==2.0.0 ; python_version >= "3.11" and python_version < "4.0" +isort==5.13.2 ; python_version >= "3.11" and python_version < "4.0" mypy-extensions==1.0.0 ; python_version >= "3.11" and python_version < "4.0" -mypy==1.6.0 ; python_version >= "3.11" and python_version < "4.0" +mypy==1.7.1 ; python_version >= "3.11" and python_version < "4.0" nodeenv==1.8.0 ; python_version >= "3.11" and python_version < "4.0" openpyxl-stubs==0.1.25 ; python_version >= "3.11" and python_version < "4.0" openpyxl==3.1.2 ; python_version >= "3.11" and python_version < "4.0" packaging==23.2 ; python_version >= "3.11" and python_version < "4.0" platformdirs==4.1.0 ; python_version >= "3.11" and python_version < "4.0" +pluggy==1.3.0 ; python_version >= "3.11" and python_version < "4.0" pre-commit==3.5.0 ; python_version >= "3.11" and python_version < "4.0" +pytest-django==4.7.0 ; python_version >= "3.11" and python_version < "4.0" +pytest==7.4.3 ; python_version >= "3.11" and python_version < "4.0" pyyaml==6.0.1 ; python_version >= "3.11" and python_version < "4.0" setuptools==69.0.2 ; python_version >= "3.11" and python_version < "4.0" sqlparse==0.4.4 ; python_version >= "3.11" and python_version < "4.0" -types-openpyxl==3.1.0.27 ; python_version >= "3.11" and python_version < "4.0" -typing-extensions==4.8.0 ; python_version >= "3.11" and python_version < "4.0" +types-openpyxl==3.1.0.32 ; python_version >= "3.11" and python_version < "4.0" +typing-extensions==4.9.0 ; python_version >= "3.11" and python_version < "4.0" tzdata==2023.3 ; python_version >= "3.11" and python_version < "4.0" and sys_platform == "win32" virtualenv==20.25.0 ; python_version >= "3.11" and python_version < "4.0" -wrapt==1.16.0 ; python_version >= "3.11" and python_version < "4.0" \ No newline at end of file +wrapt==1.16.0 ; python_version >= "3.11" and python_version < "4.0" diff --git a/requirements/production.txt b/requirements/production.txt index 824d74cf..1df4e848 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -1,16 +1,20 @@ asgiref==3.7.2 ; python_version >= "3.11" and python_version < "4.0" click==8.1.7 ; python_version >= "3.11" and python_version < "4.0" -colorama==0.4.6 ; python_version >= "3.11" and python_version < "4.0" and platform_system == "Windows" -django==4.2.7 ; python_version >= "3.11" and python_version < "4.0" +colorama==0.4.6 ; python_version >= "3.11" and python_version < "4.0" and (platform_system == "Windows" or sys_platform == "win32") +django==4.2.8 ; python_version >= "3.11" and python_version < "4.0" et-xmlfile==1.1.0 ; python_version >= "3.11" and python_version < "4.0" gunicorn==21.2.0 ; python_version >= "3.11" and python_version < "4.0" +iniconfig==2.0.0 ; python_version >= "3.11" and python_version < "4.0" mypy-extensions==1.0.0 ; python_version >= "3.11" and python_version < "4.0" -mypy==1.6.0 ; python_version >= "3.11" and python_version < "4.0" +mypy==1.7.1 ; python_version >= "3.11" and python_version < "4.0" openpyxl-stubs==0.1.25 ; python_version >= "3.11" and python_version < "4.0" openpyxl==3.1.2 ; python_version >= "3.11" and python_version < "4.0" packaging==23.2 ; python_version >= "3.11" and python_version < "4.0" +pluggy==1.3.0 ; python_version >= "3.11" and python_version < "4.0" +pytest-django==4.7.0 ; python_version >= "3.11" and python_version < "4.0" +pytest==7.4.3 ; python_version >= "3.11" and python_version < "4.0" sqlparse==0.4.4 ; python_version >= "3.11" and python_version < "4.0" -types-openpyxl==3.1.0.27 ; python_version >= "3.11" and python_version < "4.0" -typing-extensions==4.8.0 ; python_version >= "3.11" and python_version < "4.0" +types-openpyxl==3.1.0.32 ; python_version >= "3.11" and python_version < "4.0" +typing-extensions==4.9.0 ; python_version >= "3.11" and python_version < "4.0" tzdata==2023.3 ; python_version >= "3.11" and python_version < "4.0" and sys_platform == "win32" -wrapt==1.16.0 ; python_version >= "3.11" and python_version < "4.0" \ No newline at end of file +wrapt==1.16.0 ; python_version >= "3.11" and python_version < "4.0" diff --git a/setup.cfg b/setup.cfg index 702473fc..aaef89e0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,6 +5,7 @@ ignore = exclude = tests/, */migrations/, + */config/, venv/, .venv/, env/