Skip to content

Conversation

@timrid
Copy link
Contributor

@timrid timrid commented Oct 9, 2025

This adds integration tests for bleak. It works by emulating a BLE device with bumble in conjunction with an nRF52840 Dongle.

I currently only tested this with a MacBook and the CoreBluetooth backend. But in principle this should also work similar on Linux and Windows. I dont think that it will be possible to get 100% coverage (e.g. permission handling is not automatically testable), but it will catch many cases. I think, that it should also be possible to add tox to automatically test all supported python versions.

I am sharing this as a draft to get high level feedback on whether integration tests are interesting in this way. Then I would continue working on this to test the other platforms as well. I developed this, because I need some way to test my work on an rubicon-objc backend (see #1833).

Copy link
Collaborator

@dlech dlech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, having something like this would be really great. And I already have one of these dongles already.

It would help speed things up if we could split this into multiple pull requests, ideally not changing much more than 500 lines at a time. 2000+ lines is just too much to try to review all at once.

And I wouldn't worry about testing different Python versions as we generally haven't had issues related to that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not want to have binary files committed to the source tree. We can replace this with a URL to download it from a trusted source and commit a hash to source to verify that the file at the URL hasn't changed.

Setup
1. install `nrfutil`
2. install `nrf5sdk-tools` via `nrfutil install nrf5sdk-tools`
3. `pip install west`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a new group in the pyproject.toml file so that it gets installed in the virtual environment instead of globally.

Comment on lines +6 to +7
1. install `nrfutil`
2. install `nrf5sdk-tools` via `nrfutil install nrf5sdk-tools`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need some links on where to get these tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants