diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ba7b37442..636d4efba 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.7 +FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.8 WORKDIR /workspaces diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f6dba9204..d4288dde6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -16,7 +16,7 @@ "python.linting.pylintEnabled": true, "python.linting.enabled": true, "python.formatting.provider": "black", - "python.formatting.blackArgs": ["--target-version", "py37"], + "python.formatting.blackArgs": ["--target-version", "py38"], "editor.formatOnPaste": false, "editor.formatOnSave": true, "editor.formatOnType": true, diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 371218b10..b6cd3058b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -89,7 +89,7 @@ jobs: - name: Run black run: | . venv/bin/activate - black --target-version py37 --check supervisor tests setup.py + black --target-version py38 --check supervisor tests setup.py lint-dockerfile: name: Check Dockerfile @@ -345,7 +345,7 @@ jobs: needs: prepare strategy: matrix: - python-version: [3.7, 3.8] + python-version: [3.8] name: Run tests Python ${{ matrix.python-version }} steps: - name: Check out code from GitHub diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 000000000..e627dfd3c --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,15 @@ +name: Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - master + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/azure-pipelines-ci.yml b/azure-pipelines-ci.yml index 03e97dcc4..5db93f9e0 100644 --- a/azure-pipelines-ci.yml +++ b/azure-pipelines-ci.yml @@ -22,9 +22,9 @@ jobs: sudo apt-get install -y libpulse0 libudev1 displayName: "Install Host library" - task: UsePythonVersion@0 - displayName: "Use Python 3.7" + displayName: "Use Python 3.8" inputs: - versionSpec: "3.7" + versionSpec: "3.8" - script: pip install tox displayName: "Install Tox" - script: tox diff --git a/azure-pipelines-release.yml b/azure-pipelines-release.yml index ee44522f1..5dccfc276 100644 --- a/azure-pipelines-release.yml +++ b/azure-pipelines-release.yml @@ -20,9 +20,9 @@ jobs: vmImage: "ubuntu-latest" steps: - task: UsePythonVersion@0 - displayName: "Use Python 3.7" + displayName: "Use Python 3.8" inputs: - versionSpec: "3.7" + versionSpec: "3.8" - script: | setup_version="$(python setup.py -V)" branch_version="$(Build.SourceBranchName)" diff --git a/azure-pipelines-wheels.yml b/azure-pipelines-wheels.yml index ba0bab474..257c2abfe 100644 --- a/azure-pipelines-wheels.yml +++ b/azure-pipelines-wheels.yml @@ -8,7 +8,7 @@ trigger: pr: none variables: - name: versionWheels - value: '1.6.1-3.7-alpine3.11' + value: '1.13.0-3.8-alpine3.12' resources: repositories: - repository: azure diff --git a/build.json b/build.json index 5dca29692..b46db3345 100644 --- a/build.json +++ b/build.json @@ -1,11 +1,11 @@ { "image": "homeassistant/{arch}-hassio-supervisor", "build_from": { - "aarch64": "homeassistant/aarch64-base-python:3.7-alpine3.11", - "armhf": "homeassistant/armhf-base-python:3.7-alpine3.11", - "armv7": "homeassistant/armv7-base-python:3.7-alpine3.11", - "amd64": "homeassistant/amd64-base-python:3.7-alpine3.11", - "i386": "homeassistant/i386-base-python:3.7-alpine3.11" + "aarch64": "homeassistant/aarch64-base-python:3.8-alpine3.12", + "armhf": "homeassistant/armhf-base-python:3.8-alpine3.12", + "armv7": "homeassistant/armv7-base-python:3.8-alpine3.12", + "amd64": "homeassistant/amd64-base-python:3.8-alpine3.12", + "i386": "homeassistant/i386-base-python:3.8-alpine3.12" }, "labels": { "io.hass.type": "supervisor" diff --git a/setup.py b/setup.py index 200196eea..981e3718b 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ setup( "Topic :: Scientific/Engineering :: Atmospheric Science", "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", - "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", ], keywords=["docker", "home-assistant", "api"], zip_safe=False, diff --git a/tests/common.py b/tests/common.py index eed83c84d..c432bc037 100644 --- a/tests/common.py +++ b/tests/common.py @@ -7,20 +7,3 @@ def load_json_fixture(filename): """Load a fixture.""" path = Path(Path(__file__).parent.joinpath("fixtures"), filename) return json.loads(path.read_text()) - - -def mock_coro(return_value=None, exception=None): - """Return a coro that returns a value or raise an exception.""" - return mock_coro_func(return_value, exception)() - - -def mock_coro_func(return_value=None, exception=None): - """Return a method to create a coro function that returns a value.""" - - async def coro(*args, **kwargs): - """Fake coroutine.""" - if exception: - raise exception - return return_value - - return coro diff --git a/tests/conftest.py b/tests/conftest.py index 7f86bc445..c231ff8d2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,8 +5,6 @@ import pytest from supervisor.bootstrap import initialize_coresys -from tests.common import mock_coro - # pylint: disable=redefined-outer-name @@ -21,8 +19,7 @@ def docker(): async def coresys(loop, docker): """Create a CoreSys Mock.""" with patch("supervisor.bootstrap.initialize_system_data"), patch( - "supervisor.bootstrap.fetch_timezone", - return_value=mock_coro(return_value="Europe/Zurich"), + "supervisor.bootstrap.fetch_timezone", return_value="Europe/Zurich", ): coresys_obj = await initialize_coresys() diff --git a/tests/test_validate.py b/tests/test_validate.py index e4030f873..641786ba4 100644 --- a/tests/test_validate.py +++ b/tests/test_validate.py @@ -24,23 +24,23 @@ async def test_dns_url_v4_good(): assert supervisor.validate.dns_url(url) -async def test_dns_url_v6_good(): +def test_dns_url_v6_good(): """Test the DNS validator with known-good ipv6 DNS URLs.""" for url in GOOD_V6: assert supervisor.validate.dns_url(url) -async def test_dns_server_list_v4(): +def test_dns_server_list_v4(): """Test a list with v4 addresses.""" assert supervisor.validate.dns_server_list(GOOD_V4) -async def test_dns_server_list_v6(): +def test_dns_server_list_v6(): """Test a list with v6 addresses.""" assert supervisor.validate.dns_server_list(GOOD_V6) -async def test_dns_server_list_combined(): +def test_dns_server_list_combined(): """Test a list with both v4 and v6 addresses.""" combined = GOOD_V4 + GOOD_V6 # test the matches @@ -52,14 +52,14 @@ async def test_dns_server_list_combined(): supervisor.validate.dns_server_list(combined + combined + combined + combined) -async def test_dns_server_list_bad(): +def test_dns_server_list_bad(): """Test the bad list.""" # test the matches with pytest.raises(voluptuous.error.Invalid): assert supervisor.validate.dns_server_list(BAD) -async def test_dns_server_list_bad_combined(): +def test_dns_server_list_bad_combined(): """Test the bad list, combined with the good.""" combined = GOOD_V4 + GOOD_V6 + BAD diff --git a/tox.ini b/tox.ini index 2c75c7579..3ff0c7fdb 100644 --- a/tox.ini +++ b/tox.ini @@ -21,4 +21,4 @@ commands = [testenv:black] basepython = python3 commands = - black --target-version py37 --check supervisor tests setup.py + black --target-version py38 --check supervisor tests setup.py