Skip to content

Commit

Permalink
Adjust how unit tests are referencing module (#49)
Browse files Browse the repository at this point in the history
* Adjust how unit tests are referencing module

* Revert settings change

* Re-add __init__.py
  • Loading branch information
kingsleyadam authored Oct 18, 2024
1 parent 18bf2bf commit 434e737
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 29 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ jobs:
- name: Test with pytest
run: |
pytest \
--doctest-modules \
--junitxml=junit/test-results.xml \
--cov=abbfreeathome \
--cov=. \
--cov-report=xml:coverage/coverage.xml \
--cov-report=html:coverage/htmlcov
--junitxml=junit/test-results.xml
- name: Code Coverage Summary Report
id: coverage
uses: irongut/[email protected]
with:
filename: coverage/coverage.xml
Expand All @@ -51,12 +50,12 @@ jobs:
thresholds: '100 100'

- name: Write Coverage to Job Summary
if: success() || failure() # always run even if the previous step fails
if: success() || steps.coverage.conclusion == 'failure'
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY

- name: Publish Test Report
uses: mikepenz/[email protected]
if: success() || failure() # always run even if the previous step fails
if: success() || failure()
with:
report_paths: junit/test-results.xml
detailed_summary: true
Expand Down
17 changes: 15 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,26 @@
"name": "Module: abbfreeathome.api",
"type": "debugpy",
"request": "launch",
"module": "src.abbfreeathome.api"
"module": "src.abbfreeathome.api",
"justMyCode": false
},
{
"name": "Module: abbfreeathome.freeathome",
"type": "debugpy",
"request": "launch",
"module": "src.abbfreeathome.freeathome"
"module": "src.abbfreeathome.freeathome",
"justMyCode": false
},
{
"name": "Python: Debug Tests",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"purpose": [
"debug-test"
],
"console": "integratedTerminal",
"justMyCode": false
}
]
}
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,10 @@ split-on-trailing-comma = false
max-complexity = 25

[tool.pytest.ini_options]
asyncio_default_fixture_loop_scope = "function"
asyncio_default_fixture_loop_scope = "function"
pythonpath = [
"."
]

[tool.coverage.run]
omit = ["*/tests/*"]
4 changes: 2 additions & 2 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from aioresponses import aioresponses
import pytest

from abbfreeathome.api import FreeAtHomeApi, FreeAtHomeSettings
from abbfreeathome.exceptions import (
from src.abbfreeathome.api import FreeAtHomeApi, FreeAtHomeSettings
from src.abbfreeathome.exceptions import (
ConnectionTimeoutException,
ForbiddenAuthException,
InvalidApiResponseException,
Expand Down
8 changes: 4 additions & 4 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

import pytest

from abbfreeathome.api import FreeAtHomeApi
from abbfreeathome.bin.pairing import Pairing
from abbfreeathome.devices.base import Base
from abbfreeathome.exceptions import InvalidDeviceChannelPairing
from src.abbfreeathome.api import FreeAtHomeApi
from src.abbfreeathome.bin.pairing import Pairing
from src.abbfreeathome.devices.base import Base
from src.abbfreeathome.exceptions import InvalidDeviceChannelPairing


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from abbfreeathome.exceptions import (
from src.abbfreeathome.exceptions import (
ConnectionTimeoutException,
ForbiddenAuthException,
InvalidApiResponseException,
Expand Down
10 changes: 5 additions & 5 deletions tests/test_freeathome.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

import pytest

from abbfreeathome.api import FreeAtHomeApi
from abbfreeathome.bin.function import Function
from abbfreeathome.bin.interface import Interface
from abbfreeathome.devices.switch_actuator import SwitchActuator
from abbfreeathome.freeathome import FreeAtHome
from src.abbfreeathome.api import FreeAtHomeApi
from src.abbfreeathome.bin.function import Function
from src.abbfreeathome.bin.interface import Interface
from src.abbfreeathome.devices.switch_actuator import SwitchActuator
from src.abbfreeathome.freeathome import FreeAtHome


@pytest.fixture
Expand Down
4 changes: 2 additions & 2 deletions tests/test_movement_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import pytest

from abbfreeathome.api import FreeAtHomeApi
from abbfreeathome.devices.movement_detector import MovementDetector
from src.abbfreeathome.api import FreeAtHomeApi
from src.abbfreeathome.devices.movement_detector import MovementDetector


@pytest.fixture
Expand Down
4 changes: 2 additions & 2 deletions tests/test_switch_actuator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import pytest

from abbfreeathome.api import FreeAtHomeApi
from abbfreeathome.devices.switch_actuator import SwitchActuator
from src.abbfreeathome.api import FreeAtHomeApi
from src.abbfreeathome.devices.switch_actuator import SwitchActuator


@pytest.fixture
Expand Down
4 changes: 2 additions & 2 deletions tests/test_switch_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import pytest

from abbfreeathome.api import FreeAtHomeApi
from abbfreeathome.devices.switch_sensor import SwitchSensor
from src.abbfreeathome.api import FreeAtHomeApi
from src.abbfreeathome.devices.switch_sensor import SwitchSensor


@pytest.fixture
Expand Down
4 changes: 2 additions & 2 deletions tests/test_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import pytest

from abbfreeathome.api import FreeAtHomeApi
from abbfreeathome.devices.trigger import Trigger
from src.abbfreeathome.api import FreeAtHomeApi
from src.abbfreeathome.devices.trigger import Trigger


@pytest.fixture
Expand Down

0 comments on commit 434e737

Please sign in to comment.