Skip to content

Commit a95b3ba

Browse files
committed
Rename.
1 parent fa03051 commit a95b3ba

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ installed (``pip install pytest pytest-coverage``).
7777

7878
Run the unit tests with the following command::
7979

80-
$ pytest --cov-report term-missing --cov=adafruit_radio tests/
80+
$ pytest --cov-report term-missing --cov=adafruit_ble_radio tests/
8181

8282
Contributing
8383
============

docs/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
.. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py)
55
.. use this format as the module name: "adafruit_foo.foo"
66
7-
.. automodule:: adafruit_radio
7+
.. automodule:: adafruit_ble_radio
88
:members:

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Uncomment the below if you use native CircuitPython modules such as
2222
# digitalio, micropython and busio. List the modules you use. Without it, the
2323
# autodoc module docs will fail to generate with a warning.
24-
autodoc_mock_imports = ["digitalio", "busio", "adafruit_ble"]
24+
autodoc_mock_imports = ["digitalio", "busio", "adafruit_ble", "micropython"]
2525

2626

2727
intersphinx_mapping = {
@@ -38,7 +38,7 @@
3838
master_doc = "index"
3939

4040
# General information about the project.
41-
project = "Adafruit radio Library"
41+
project = "Adafruit BLE Radio Library"
4242
copyright = "2019 Nicholas H.Tollervey"
4343
author = "Nicholas H.Tollervey"
4444

tests/test_adafruit_radio.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
2-
Simple unit tests for the adafruit_radio module. Uses experimental mocking
2+
Simple unit tests for the adafruit_ble_radio module. Uses experimental mocking
33
found in the testconf.py file. See comments therein for explanation of how it
44
works.
55
"""
6-
import adafruit_radio
6+
import adafruit_ble_radio
77
import pytest
88
import struct
99
import time
@@ -15,7 +15,7 @@ def radio():
1515
"""
1616
A fixture to recreate a new Radio instance for each test that needs it.
1717
"""
18-
return adafruit_radio.Radio()
18+
return adafruit_ble_radio.Radio()
1919

2020

2121
def test_radio_init_default():
@@ -27,8 +27,8 @@ def test_radio_init_default():
2727
* The self.msg_pool is initialised as an empty set.
2828
* The channel is set to the default 42.
2929
"""
30-
r = adafruit_radio.Radio()
31-
assert r.ble == adafruit_radio.BLERadio()
30+
r = adafruit_ble_radio.Radio()
31+
assert r.ble == adafruit_ble_radio.BLERadio()
3232
assert r.uid == 0
3333
assert r.msg_pool == set()
3434
assert r._channel == 42
@@ -38,7 +38,7 @@ def test_radio_init_channel():
3838
"""
3939
If a channel argument is passed to initialisation, this is correctly set.
4040
"""
41-
r = adafruit_radio.Radio(channel=7)
41+
r = adafruit_ble_radio.Radio(channel=7)
4242
assert r._channel == 7
4343

4444

@@ -83,7 +83,7 @@ def test_radio_send_bytes_too_long(radio):
8383
A ValueError is raised if the message to be sent is too long (defined by
8484
MAX_LENGTH).
8585
"""
86-
msg = bytes(adafruit_radio.MAX_LENGTH + 1)
86+
msg = bytes(adafruit_ble_radio.MAX_LENGTH + 1)
8787
with pytest.raises(ValueError):
8888
radio.send_bytes(msg)
8989

@@ -95,10 +95,10 @@ def test_radio_send_bytes(radio):
9595
"""
9696
radio.uid = 255 # set up for cycle back to 0.
9797
msg = b"Hello"
98-
with mock.patch("adafruit_radio.time.sleep") as mock_sleep:
98+
with mock.patch("adafruit_ble_radio.time.sleep") as mock_sleep:
9999
radio.send_bytes(msg)
100-
mock_sleep.assert_called_once_with(adafruit_radio.AD_DURATION)
101-
spy_advertisement = adafruit_radio.AdafruitRadio()
100+
mock_sleep.assert_called_once_with(adafruit_ble_radio.AD_DURATION)
101+
spy_advertisement = adafruit_ble_radio.AdafruitRadio()
102102
chan = struct.pack("<B", radio._channel)
103103
uid = struct.pack("<B", 255)
104104
assert spy_advertisement.msg == chan + uid + msg
@@ -136,7 +136,7 @@ def test_radio_receive_full_no_messages(radio):
136136
radio.ble.start_scan.return_value = []
137137
assert radio.receive_full() is None
138138
radio.ble.start_scan.assert_called_once_with(
139-
adafruit_radio.AdafruitRadio, minimum_rssi=-255, timeout=1, extended=True
139+
adafruit_ble_radio.AdafruitRadio, minimum_rssi=-255, timeout=1, extended=True
140140
)
141141
radio.ble.stop_scan.assert_called_once_with()
142142

@@ -169,7 +169,7 @@ def test_radio_receive_full_and_remove_expired_message_metadata(radio):
169169
mock_entry.address.address_bytes = b"adr2"
170170
mock_entry.rssi = -40
171171
radio.ble.start_scan.return_value = [mock_entry]
172-
radio.msg_pool.add((time.monotonic() - adafruit_radio.AD_DURATION - 1, 42, 0, b"addr"))
172+
radio.msg_pool.add((time.monotonic() - adafruit_ble_radio.AD_DURATION - 1, 42, 0, b"addr"))
173173
result = radio.receive_full()
174174
assert result[0] == b"Hello"
175175
assert result[1] == -40

0 commit comments

Comments
 (0)