A bunch of fake interfaces for development when not using the RPi or unit testing
I do a lot of development on my Powerbook and I got tired of constantly creating a fake interface for dev on my laptop and testing on Travis.ci.
2017 Apr 2: Beta Quality
The preferred way to install this is:
pip install fake_rpi
To submit pull requests and do development:
git clone cd fake_rpi pip install -e .
To use as is:
from fake_rpi import GPIO as io from fake_rpi import smbus io.setmode(io.BCM) b = io.input(21) sm = smbus.SMBus(1) b = sm.read_byte_data(0x21, 0x32) # read in a byte
But I need smbus to return a specific byte for unit testing:
from fake_rpi import smbus from fake_rpi import printf class MyBus(smbus.SMBus): @printf def read_byte_data(self, i2c_addr, register): ret = 0xff if i2c_addr == 0x21: ret = 0x55 elif i2c_addr == 0x25: ret = 0x11 return ret sm = MyBus() b = sm.read_byte_data(0x21, 0x32) # read in a byte
- add serial
- double check interfaces and flush them out better
The MIT License (MIT)
Copyright (c) 2017 Kevin J. Walchko
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size fake_rpi-0.0.1-py2-none-any.whl (7.0 kB)||File type Wheel||Python version py2||Upload date||Hashes View|