conftest.py 377 B

123456789101112131415161718
  1. import unittest.mock
  2. import pytest
  3. import cc1101
  4. @pytest.fixture(scope="function")
  5. def transceiver():
  6. with unittest.mock.patch("spidev.SpiDev"):
  7. return cc1101.CC1101()
  8. @pytest.fixture(scope="function")
  9. def libgpiod_mock():
  10. mock = unittest.mock.MagicMock()
  11. with unittest.mock.patch("cc1101._gpio._load_libgpiod", return_value=mock):
  12. yield mock