Skip to content

Commit

Permalink
Adjust how unit tests are referencing module
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsleyadam committed Oct 18, 2024
1 parent 18bf2bf commit e42ab2e
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 30 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
}
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"python.testing.pytestArgs": [
"."
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
Expand Down
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 = ["*/test*"]
Empty file removed tests/__init__.py
Empty file.
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 e42ab2e

Please sign in to comment.