Skip to content
Merged
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
30 changes: 18 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,25 @@ repos:
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/pycqa/isort
rev: 6.0.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.0
hooks:
- id: isort
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/psf/black
rev: 25.1.0
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
- id: black
language_version: python3
- id: mypy
exclude: ^(examples)
args: [
--config-file, pyproject.toml,

- repo: https://github.com/pycqa/flake8
rev: 7.1.2
hooks:
- id: flake8
additional_dependencies: [flake8-docstrings, flake8-pyproject]
]
additional_dependencies: [
bleak==0.22.3,
rich==13.9.4,
packaging,
prompt_toolkit>=3.0.0,
]
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
"python.testing.pytestEnabled": true,
"flake8.enabled": false
}
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@ clean-test: ## remove test and coverage artifacts
rm -fr .pytest_cache/

lint: ## check style
$(PY_CMD_PREFIX) black --check .
$(PY_CMD_PREFIX) isort --check .
$(PY_CMD_PREFIX) flake8 .
$(PY_CMD_PREFIX) ruff check .
$(PY_CMD_PREFIX) ruff format --check .

format: ## format code
$(PY_CMD_PREFIX) black .
$(PY_CMD_PREFIX) isort .
$(PY_CMD_PREFIX) ruff format .
$(PY_CMD_PREFIX) ruff check --fix .

typecheck: ## type check code
$(PY_CMD_PREFIX) mypy
Expand All @@ -84,6 +83,9 @@ pre-commit: ## run pre-commit checks
test: ## run tests quickly with the default Python
$(PY_CMD_PREFIX) pytest

test-coverage: ## run tests with coverage
$(PY_CMD_PREFIX) pytest --cov=test_a_ble

check: ## run all checks
$(PY_CMD_PREFIX) tox

Expand Down
9 changes: 4 additions & 5 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
"""
Configuration file for the Sphinx documentation builder.
"""Configuration file for the Sphinx documentation builder.

This file contains the configuration settings for generating the project's documentation.
"""

import os
import sys
from pathlib import Path

sys.path.insert(0, os.path.abspath("../.."))
sys.path.insert(0, str(Path(__file__).parent.parent.parent.resolve()))

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "Test-a-BLE"
copyright = "2025, NRB Tech Ltd"
copyright = "2025, NRB Tech Ltd" # noqa: A001
author = "NRB Tech Ltd"
release = "0.1.0"

Expand Down
3 changes: 1 addition & 2 deletions examples/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
BLE Test Framework Examples.
"""BLE Test Framework Examples.

Examples demonstrating usage of the BLE IoT device testing framework.
"""
3 changes: 1 addition & 2 deletions examples/nordic_blinky/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Nordic Blinky Example.
"""Nordic Blinky Example.

Example tests for the Nordic Semiconductor BLE Blinky sample application.
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/peripheral_lbs/README.html
Expand Down
3 changes: 1 addition & 2 deletions examples/nordic_blinky/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Nordic Blinky Example Configuration.
"""Nordic Blinky Example Configuration.

Configuration for the Nordic Semiconductor BLE Blinky sample application.
"""
Expand Down
24 changes: 13 additions & 11 deletions examples/nordic_blinky/tests/test_blinky.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
"""
Nordic Blinky Tests.
"""Nordic Blinky Tests.

Tests for the Nordic Semiconductor BLE Blinky sample application.
These tests demonstrate controlling the LED and receiving button state notifications.
"""

import asyncio

from config import (
from nordic_blinky.config import (
BUTTON_PRESSED,
BUTTON_RELEASED,
CHAR_BUTTON,
Expand All @@ -22,17 +21,16 @@

@ble_test_class("Blinky Tests")
class BlinkyTests:
"""
Tests for the Nordic Semiconductor BLE Blinky sample application.
"""Tests for the Nordic Semiconductor BLE Blinky sample application.

These tests demonstrate controlling the LED and receiving button state notifications.
"""

async def setUp(self, ble_manager: BLEManager, test_context: TestContext):
async def setUp(self, _ble_manager: BLEManager, test_context: TestContext):
"""Set up the test environment."""
test_context.debug("Setting up the test environment")

async def tearDown(self, ble_manager: BLEManager, test_context: TestContext):
async def tearDown(self, _ble_manager: BLEManager, test_context: TestContext):
"""Tear down the test environment."""
test_context.debug("Tearing down the test environment")

Expand Down Expand Up @@ -117,7 +115,9 @@ async def test_button_press(self, ble_manager: BLEManager, test_context: TestCon
["Please PRESS the button on the device to demonstrate BLE notifications."],
)
press_result = await test_context.wait_for_notification_interactive(
characteristic_uuid=CHAR_BUTTON, expected_value=BUTTON_PRESSED, timeout=15.0
characteristic_uuid=CHAR_BUTTON,
expected_value=BUTTON_PRESSED,
timeout=15.0,
)

# Button press detected
Expand Down Expand Up @@ -163,10 +163,12 @@ async def test_led_button_interaction(self, ble_manager: BLEManager, test_contex
test_context.debug("Waiting for button press to turn on LED")
test_context.print_formatted_box(
"WAITING FOR NOTIFICATION",
["Press and HOLD the button on the device.\n" "The LED should remain OFF until you press the button."],
["Press and HOLD the button on the device.\nThe LED should remain OFF until you press the button."],
)
press_result = await test_context.wait_for_notification_interactive(
characteristic_uuid=CHAR_BUTTON, expected_value=BUTTON_PRESSED, timeout=15.0
characteristic_uuid=CHAR_BUTTON,
expected_value=BUTTON_PRESSED,
timeout=15.0,
)

# If we get here, button press was successful
Expand Down Expand Up @@ -196,7 +198,7 @@ async def test_led_button_interaction(self, ble_manager: BLEManager, test_contex
test_context.debug("Waiting for button release to turn off LED")
test_context.print_formatted_box(
"WAITING FOR NOTIFICATION",
["RELEASE the button now.\n" "When you release the button, the LED should turn OFF."],
["RELEASE the button now.\nWhen you release the button, the LED should turn OFF."],
)
await test_context.wait_for_notification_interactive(
characteristic_uuid=CHAR_BUTTON,
Expand Down
169 changes: 0 additions & 169 deletions examples/nordic_blinky/verify_fixes.py

This file was deleted.

Loading