Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjones4 committed Aug 23, 2021
1 parent a2c0a55 commit 1a9d562
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-air.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
- name: Install Python Dependencies
run: |
cd air
Expand Down
15 changes: 8 additions & 7 deletions air/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from threading import Thread

from whitevest.lib.atomic_value import AtomicValue
from whitevest.lib.atomic_buffer import AtomicBuffer
from whitevest.lib.configuration import Configuration
from whitevest.lib.const import TELEMETRY_TUPLE_LENGTH
from whitevest.lib.utils import (
Expand Down Expand Up @@ -55,7 +56,7 @@ def test_digest_next_sensor_reading():
gps_value = [random.random() for _ in range(4)]
magnetometer_accelerometer_value = [random.random() for _ in range(6)]
data_queue = Queue()
current_reading = AtomicValue()
current_reading = AtomicBuffer(1)
now = digest_next_sensor_reading(
start_time,
data_queue,
Expand All @@ -73,8 +74,8 @@ def test_digest_next_sensor_reading():
)
assert logged
assert logged == expected_tuple
assert current_reading.get_value() == expected_tuple
assert len(logged) == TELEMETRY_TUPLE_LENGTH - 1
assert current_reading.read()[0] == expected_tuple
assert len(logged) == TELEMETRY_TUPLE_LENGTH


def test_write_sensor_log():
Expand Down Expand Up @@ -103,13 +104,13 @@ def test_transmit_latest_readings():
start_time = time.time()
rfm9x = MockRFM9X()
camera_is_running = AtomicValue(0.0)
current_reading = AtomicValue(
[random.random() for _ in range(TELEMETRY_TUPLE_LENGTH - 1)]
)
current_reading = AtomicBuffer(2)
current_reading.put([random.random() for _ in range(TELEMETRY_TUPLE_LENGTH)])
current_reading.put([random.random() for _ in range(TELEMETRY_TUPLE_LENGTH)])
readings_sent_1, last_check_1 = transmit_latest_readings(
camera_is_running, rfm9x, last_check, readings_sent, start_time, current_reading
)
assert readings_sent_1 > readings_sent
assert last_check < last_check_1
assert last_check_1 <= time.time()
assert len(rfm9x.sent) == (TELEMETRY_TUPLE_LENGTH * 8)
assert len(rfm9x.sent) == (TELEMETRY_TUPLE_LENGTH * 8 * 2) + 8
7 changes: 4 additions & 3 deletions air/whitevest/bin/test_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import time

from whitevest.lib.atomic_value import AtomicValue
from whitevest.lib.atomic_buffer import AtomicBuffer
from whitevest.lib.configuration import Configuration
from whitevest.lib.const import TELEMETRY_TUPLE_LENGTH
from whitevest.lib.hardware import (
Expand Down Expand Up @@ -44,9 +45,9 @@ def test_rfm9x(configuration: Configuration):
rfm9x = init_radio(configuration)
if rfm9x:
camera_is_running = AtomicValue(0.0)
current_reading = AtomicValue(
[0.0 for _ in range(TELEMETRY_TUPLE_LENGTH - 1)]
)
current_reading = AtomicBuffer(2)
current_reading.put([0.0 for _ in range(TELEMETRY_TUPLE_LENGTH)])
current_reading.put([0.0 for _ in range(TELEMETRY_TUPLE_LENGTH)])
start_time = time.time()
transmissions = 0
while time.time() - start_time < TEST_TIME_LENGTH:
Expand Down

0 comments on commit 1a9d562

Please sign in to comment.