def test__helper_fixture_replaces_real_smbus_implementation(emulated_smbus, tmpdir): i2c_dev = Path(tmpdir.mkdir('i2c-9999')) # unlikely to be valid bus = LinuxI2cBus(i2c_dev=i2c_dev) bus.open() assert type(bus._smbus) == emulated_smbus
def emulated_device(tmpdir, emulated_smbus): i2c_dev = Path(tmpdir.mkdir('i2c-0')) bus = LinuxI2cBus(i2c_dev=i2c_dev) dev = SmbusDriver(smbus=bus, description='Test', vendor_id=-1, product_id=-1, address=-1) return (bus, dev)