Skip to content
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

Fix HACS validation errors by updating hacs.json and manifest.json #25

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Setup Python
uses: "actions/setup-python@v1"
with:
python-version: "3.8"
python-version: "3.12"
- name: Install requirements
run: python3 -m pip install -r requirements_test.txt
- name: Run tests
Expand All @@ -50,6 +50,7 @@ jobs:
--durations=10 \
-n auto \
--cov custom_components.stadtreinigung_hamburg \
--cov-report=term-missing \
-o console_output_style=count \
-p no:sugar \
tests
8 changes: 4 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
name: Check style formatting
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
- uses: "actions/setup-python@v4"
with:
python-version: "3.x"
python-version: "3.12"
- run: python3 -m pip install black
- run: black .

Expand All @@ -43,7 +43,7 @@ jobs:
# - name: Setup Python
# uses: "actions/setup-python@v1"
# with:
# python-version: "3.8"
# python-version: "3.12"
# - name: Install requirements
# run: python3 -m pip install -r requirements_test.txt
# - name: Run tests
Expand All @@ -56,4 +56,4 @@ jobs:
# --cov custom_components.stadtreinigung_hamburg \
# -o console_output_style=count \
# -p no:sugar \
# tests
# tests
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
"""The Stadtreinigung Hamburg integration"""
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import Config, HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.const import CONF_NAME

DOMAIN = "stadtreinigung_hamburg"

CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)

async def async_setup(hass, config):
"""Do not allow config via configuration.yaml"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"domain": "stadtreinigung_hamburg",
"name": "Stadtreinigung Hamburg",
"documentation": "https://github.com/custom-components/sensor.stadtreinigung_hamburg",
"issue_tracker": "https://github.com/custom-components/sensor.stadtreinigung_hamburg/issues",
"dependencies": [],
"codeowners": [
"@vigonotion"
Expand All @@ -11,5 +12,6 @@
"lxml_html_clean"
],
"config_flow": true,
"version": "1.1.2"
"iot_class": "cloud_polling",
"version": "1.1.5"
}
12 changes: 4 additions & 8 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"name": "Stadtreinigung Hamburg",
"domains": [
"sensor"
],
"country": "DE",
"homeassistant": "0.109.0",
"zip_release": true,
"filename": "stadtreinigung_hamburg.zip"
}
"content_in_root": false,
"filename": "stadtreinigung_hamburg.zip",
"render_readme": true
}
6 changes: 6 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[pytest]
asyncio_mode = auto
testpaths = tests
python_files = test_*.py
python_classes = Test*
python_functions = test_*
5 changes: 4 additions & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
pytest-homeassistant-custom-component==0.3.0
pytest-homeassistant-custom-component==0.13.175
pytest==8.3.3
pytest-cov==5.0.0
pytest-xdist==3.6.1
Empty file added tests/__init__.py
Empty file.
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest_plugins = ["pytest_homeassistant_custom_component"]
25 changes: 25 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import pytest
from homeassistant.setup import async_setup_component
from homeassistant.const import STATE_UNKNOWN

@pytest.mark.asyncio
async def test_setup(hass, enable_custom_integrations):
"""Test that the component can be setup and creates sensors."""
config = {
'stadtreinigung_hamburg': {
'name': 'Test Sensor',
'street': 'Jungfernstieg',
'number': '1',
}
}
assert await async_setup_component(hass, 'stadtreinigung_hamburg', config)

Check failure on line 15 in tests/test_init.py

View workflow job for this annotation

GitHub Actions / Run tests

test_setup assert False
await hass.async_block_till_done()

# Check that the component is loaded
assert 'stadtreinigung_hamburg' in hass.config.components

# Verify that sensors are created
state = hass.states.get('sensor.test_sensor')
assert state is not None
assert state.state != STATE_UNKNOWN

Loading