diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index be06aeef..d61ea0ce 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.8 +FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.9 # install test requirements COPY requirements*.txt /tmp/pip-tmp/ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b86a0937..4980aab5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,30 +5,34 @@ "postCreateCommand": "scripts/setup", "containerEnv": { "DEVCONTAINER": "1" }, "runArgs": ["-e", "GIT_EDITOR=code --wait"], - "extensions": [ - "ms-python.vscode-pylance", - "visualstudioexptteam.vscodeintellicode", - "esbenp.prettier-vscode" - ], - // Please keep this file in sync with settings in .vscode/settings.default.json - "settings": { - "python.pythonPath": "/usr/local/bin/python", - "python.linting.pylintEnabled": true, - "python.linting.enabled": true, - "python.formatting.provider": "black", - "python.testing.pytestArgs": ["tests"], - "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true, - "python.linting.mypyEnabled": true, - "editor.formatOnPaste": false, - "editor.formatOnSave": true, - "editor.formatOnType": true, - "files.trimTrailingWhitespace": true, - "terminal.integrated.profiles.linux": { - "zsh": { - "path": "/usr/bin/zsh" + "customizations": { + "vscode": { + "extensions": [ + "ms-python.vscode-pylance", + "ms-python.black-formatter", + "ms-python.pylint", + "ms-python.mypy-type-checker", + "visualstudioexptteam.vscodeintellicode", + "esbenp.prettier-vscode" + ], + // Please keep this file in sync with settings in .vscode/settings.default.json + "settings": { + "python.pythonPath": "/usr/local/bin/python", + "python.testing.pytestArgs": ["tests"], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + "mypy-type-checker.args": ["--config-file=pyproject.toml"], + "editor.formatOnPaste": false, + "editor.formatOnSave": true, + "editor.formatOnType": true, + "files.trimTrailingWhitespace": true, + "terminal.integrated.profiles.linux": { + "zsh": { + "path": "/usr/bin/zsh" + } + }, + "terminal.integrated.defaultProfile.linux": "zsh" } - }, - "terminal.integrated.defaultProfile.linux": "zsh" + } } } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f071aed5..0a1ca5d2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5.1.1 with: - python-version: "3.10" + python-version: "3.12" - name: Install build dependencies run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f6c58aa5..0221c0e0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,10 +13,10 @@ jobs: - name: Check out the repository uses: actions/checkout@v4.1.7 - - name: Set up Python 3.8 + - name: Set up Python 3.9 uses: actions/setup-python@v5.1.1 with: - python-version: "3.8" + python-version: "3.9" - name: Install dependencies run: | @@ -55,9 +55,10 @@ jobs: fail-fast: false matrix: include: - - python-version: "3.8" - python-version: "3.9" - python-version: "3.10" + - python-version: "3.11" + - python-version: "3.12" steps: - name: Check out the repository @@ -90,10 +91,10 @@ jobs: - name: Check out the repository uses: actions/checkout@v4.1.7 - - name: Set up Python 3.10 + - name: Set up Python 3.12 uses: actions/setup-python@v5.1.1 with: - python-version: "3.10" + python-version: "3.12" - name: Install dependencies run: | @@ -128,7 +129,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5.1.1 with: - python-version: "3.10" + python-version: "3.12" - name: Install build dependencies run: | diff --git a/.vscode/settings.default.json b/.vscode/settings.default.json index 27c3a3f6..89e87041 100644 --- a/.vscode/settings.default.json +++ b/.vscode/settings.default.json @@ -1,9 +1,6 @@ { - "python.formatting.provider": "black", - "python.linting.pylintEnabled": true, - "python.linting.enabled": true, "python.testing.pytestArgs": ["tests"], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, - "python.linting.mypyEnabled": true + "mypy-type-checker.args": ["--config-file=pyproject.toml"] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 7023ac43..b8caae23 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,6 +12,15 @@ "isDefault": true } }, + { + "label": "coverage", + "type": "shell", + "command": "coverage run --parallel -m pytest ; coverage combine ; coverage report", + "group": { + "kind": "test", + "isDefault": false + } + }, { "label": "reinstall dependencies", "type": "shell", diff --git a/pyproject.toml b/pyproject.toml index 2c86176c..e882d77f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,13 +18,14 @@ classifiers = [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Software Development :: Libraries", ] keywords=["synology-dsm", "synology"] -requires-python = ">=3.8.0" +requires-python = ">=3.9" dependencies = ["aiohttp"] [project.urls] @@ -53,6 +54,9 @@ fail_under = 80 profile = "black" src_paths = ["src", "tests"] +[tool.mypy] +exclude = ["tests/"] + [tool.pylint.MAIN] ignore = ["tests"] diff --git a/requirements_dev.txt b/requirements_dev.txt index 1ab3ca31..e38103af 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -9,7 +9,7 @@ flake8==7.0.0 mypy==1.10.0 pep8-naming==0.14.1 pre-commit-hooks==4.6.0 -pre-commit==3.2.2 +pre-commit==3.7.0 Pygments==2.18.0 pylint==3.1.0 pytest-asyncio==0.23.7 diff --git a/tests/test_synology_dsm_7.py b/tests/test_synology_dsm_7.py index 2c3bade4..4bb3353c 100644 --- a/tests/test_synology_dsm_7.py +++ b/tests/test_synology_dsm_7.py @@ -3,6 +3,18 @@ # pylint: disable=protected-access import pytest +from synology_dsm.api.core.external_usb import SynoCoreExternalUSB +from synology_dsm.api.core.security import SynoCoreSecurity +from synology_dsm.api.core.share import SynoCoreShare +from synology_dsm.api.core.system import SynoCoreSystem +from synology_dsm.api.core.upgrade import SynoCoreUpgrade +from synology_dsm.api.core.utilization import SynoCoreUtilization +from synology_dsm.api.download_station import SynoDownloadStation +from synology_dsm.api.dsm.information import SynoDSMInformation +from synology_dsm.api.dsm.network import SynoDSMNetwork +from synology_dsm.api.photos import SynoPhotos +from synology_dsm.api.storage.storage import SynoStorage +from synology_dsm.api.surveillance_station import SynoSurveillanceStation from synology_dsm.const import API_AUTH from synology_dsm.exceptions import SynologyDSMLogin2SARequiredException @@ -15,6 +27,7 @@ VALID_USER_2SA, SynologyDSMMock, ) +from .api_data.dsm_7 import DSM_7_API_INFO from .const import DEVICE_TOKEN, SESSION_ID, SYNO_TOKEN @@ -28,6 +41,20 @@ async def test_login(self, dsm_7): assert dsm_7.apis.get(API_AUTH) assert dsm_7._session_id == SESSION_ID assert dsm_7._syno_token == SYNO_TOKEN + assert dsm_7.device_token is None + assert dsm_7.apis == DSM_7_API_INFO["data"] + assert isinstance(dsm_7.download_station, SynoDownloadStation) + assert isinstance(dsm_7.external_usb, SynoCoreExternalUSB) + assert isinstance(dsm_7.information, SynoDSMInformation) + assert isinstance(dsm_7.network, SynoDSMNetwork) + assert isinstance(dsm_7.photos, SynoPhotos) + assert isinstance(dsm_7.security, SynoCoreSecurity) + assert isinstance(dsm_7.share, SynoCoreShare) + assert isinstance(dsm_7.storage, SynoStorage) + assert isinstance(dsm_7.surveillance_station, SynoSurveillanceStation) + assert isinstance(dsm_7.system, SynoCoreSystem) + assert isinstance(dsm_7.upgrade, SynoCoreUpgrade) + assert isinstance(dsm_7.utilisation, SynoCoreUtilization) @pytest.mark.asyncio async def test_login_2sa(self):