Преглед на файлове

extend test coverage of CC1101._get_received_packet()

Fabian Peter Hammerle преди 8 месеца
родител
ревизия
b89ec72320
променени са 2 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 1 1
      .github/workflows/python.yml
  2. 4 0
      tests/test_receive.py

+ 1 - 1
.github/workflows/python.yml

@@ -57,7 +57,7 @@ jobs:
       env:
         PYTHON_VERSION: ${{ matrix.python-version }}
     - run: pipenv graph
-    - run: pipenv run pytest --cov="$(cat *.egg-info/top_level.txt)" --cov-report=term-missing --cov-fail-under=99
+    - run: pipenv run pytest --cov="$(cat *.egg-info/top_level.txt)" --cov-report=term-missing --cov-fail-under=100
     - run: pipenv run pylint "$(cat *.egg-info/top_level.txt)"
     # https://github.com/PyCQA/pylint/issues/352
     - run: pipenv run pylint tests/*

+ 4 - 0
tests/test_receive.py

@@ -46,6 +46,10 @@ def test__get_received_packet(transceiver, payload):
     assert received_packet._rssi_index == 128
     assert received_packet.checksum_valid
     assert received_packet.link_quality_indicator == 42
+    with unittest.mock.patch.object(
+        transceiver, "_read_status_register", return_value=0
+    ):
+        assert transceiver._get_received_packet() is None
 
 
 @pytest.mark.parametrize("gdo0_gpio_line_name", (b"GPIO24", b"GPIO25"))