"""Test operations for interfacing directly with a Pico.""" import os import struct import sys import unittest.mock as mock from array import array from decorator import decorator import gp2040ce_bintools.pico as pico HERE = os.path.dirname(os.path.abspath(__file__)) @decorator def with_pb2s(test, *args, **kwargs): """Wrap a test with precompiled pb2 files on the path.""" proto_path = os.path.join(HERE, 'test-files', 'pb2-files') sys.path.append(proto_path) test(*args, **kwargs) sys.path.pop() del sys.modules['config_pb2'] def test_exclusive_access(): """Test that we can get exclusive access to a BOOTSEL board.""" end_out, end_in = mock.MagicMock(), mock.MagicMock() pico.exclusive_access(end_out, end_in) payload = struct.pack('