summaryrefslogtreecommitdiffstats
path: root/tests/test_discover.py
diff options
context:
space:
mode:
authorAlex Schofield <git@ajschof.me>2025-02-07 15:13:21 +0000
committerAlex Schofield <git@ajschof.me>2025-02-07 15:13:21 +0000
commit8499a404322dc37af2afae05ec5630b366656b27 (patch)
tree33aa0d4b418e6bfaa867cef25514e9ee6695bfe7 /tests/test_discover.py
parent5a12715276d7166eed0ff776a7b13b0670c8a28c (diff)
downloadtp-logger-8499a404322dc37af2afae05ec5630b366656b27.tar.gz
tp-logger-8499a404322dc37af2afae05ec5630b366656b27.zip
improve debug flag checks for pytest
Diffstat (limited to 'tests/test_discover.py')
-rw-r--r--tests/test_discover.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/test_discover.py b/tests/test_discover.py
index 22e1d73..c6d6ab2 100644
--- a/tests/test_discover.py
+++ b/tests/test_discover.py
@@ -1,6 +1,6 @@
from unittest import IsolatedAsyncioTestCase
from unittest.mock import AsyncMock, patch
-from discover import discover
+from discover import main
from bleak.backends.device import BLEDevice
import os
@@ -8,11 +8,10 @@ class TestDiscover(IsolatedAsyncioTestCase):
@patch('src.discover.BleakScanner.discover', new_callable=AsyncMock)
async def test_device_discovery_successful(self, mock_discover):
device_1 = BLEDevice(address="AA:BB:CC:DD:EE:FF", name="TP350S", details={}, rssi=-40)
- device_2 = BLEDevice(address="GG:HH:II:JJ:KK:LL", name="Device 2", details={}, rssi=-64)
mock_discover.return_value = [device_1]
- result = await discover()
+ result = await main(debug_flag=False)
expected = [
{"name": "TP350S", "address": "AA:BB:CC:DD:EE:FF"},
@@ -27,8 +26,7 @@ class TestDiscover(IsolatedAsyncioTestCase):
mock_discover.return_value = [device_1, device_2]
- with patch.dict(os.environ, {"DEBUG": "TRUE"}):
- result = await discover()
+ result = await main(debug_flag=True)
expected = [
{"name": "TP350S", "address": "AA:BB:CC:DD:EE:FF"},
git.ajschof.me — hosted by ajschofield — powered by cgit