Comments (3)
smbus2 uses os.open
to open the device, something that pyfakefs does not support: https://github.com/jmcgeheeiv/pyfakefs/blob/b7fc0b4d0c4d2a32197aa27ac48b30b2dca39f75/fake_filesystem_test.py#L867
from luma.core.
For example:
====================================================================== FAILURES =======================================================================
_____________________________________________________________ test_init_device_not_found ______________________________________________________________
def test_init_device_not_found():
from pyfakefs import fake_filesystem
fs = fake_filesystem.FakeFilesystem()
os_module = fake_filesystem.FakeOsModule(fs)
pathname = '/dev/i2c-200'
new_file = fs.CreateFile(pathname)
port = 200
address = 0x710
with patch('smbus2.smbus2.os', os_module):
with pytest.raises(luma.core.error.DeviceNotFoundError) as ex:
> i2c(port=port, address=address)
tests/test_i2c.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
luma/core/serial.py:60: in __init__
self._bus = bus or smbus2.SMBus(port)
.tox/py35/lib/python3.5/site-packages/smbus2/smbus2.py:132: in __init__
self.open(bus)
.tox/py35/lib/python3.5/site-packages/smbus2/smbus2.py:142: in open
self.fd = os.open("/dev/i2c-{}".format(bus), os.O_RDWR)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyfakefs.fake_filesystem.FakeOsModule object at 0x7fb266422cf8>, file_path = '/dev/i2c-200', flags = 2, mode = None
def open(self, file_path, flags, mode=None):
"""Return the file descriptor for a FakeFile.
WARNING: This implementation only implements creating a file. Please fill
out the remainder for your needs.
Args:
file_path: the path to the file
flags: low-level bits to indicate io operation
mode: bits to define default permissions
Returns:
A file descriptor.
Raises:
OSError: if the path cannot be found
ValueError: if invalid mode is given
NotImplementedError: if an unsupported flag is passed in
"""
if flags & os.O_CREAT:
fake_file = FakeFileOpen(self.filesystem)(file_path, 'w')
if mode:
self.chmod(file_path, mode)
return fake_file.fileno()
else:
> raise NotImplementedError('FakeOsModule.open')
E NotImplementedError: FakeOsModule.open
.tox/py35/lib/python3.5/site-packages/pyfakefs/fake_filesystem.py:2595: NotImplementedError
from luma.core.
I'll create a wrapper for FakeOsModule
.
from luma.core.
Related Issues (20)
- add test for SPI cs_high warning
- Reduce the build jobs on Travis ... or use Github Actions HOT 6
- Possible to use diff-algorithm with linux_framebuffer device? HOT 8
- Add docs for last luma.core that supports Python 2.7
- luma.core.device.device is missing in api documentation HOT 1
- Supporting 32-bit depth for linux_framebuffer HOT 2
- Use github actions to publish to pypi HOT 5
- Configure setup() using setup.cfg file
- IndexError: Font does not have ASCII code: 8211 (or 8212,8217,8220,8221) HOT 2
- VFD support in Luma HOT 9
- Crash @ Raspi3 install with "syntax error" ... already tried with Python 3.8.4 HOT 5
- Support for Orange Pi GPIO module HOT 4
- How do proper cleanup/release resources when using luma.core?
- Unnecessary delete statement in function (identified with LGTM.com) HOT 3
- remove deprecated cmdline.make_serial
- ftdi_spi doesn't appear to support chips with more than 8 GPIO's HOT 8
- Drop support for Python 3.6 HOT 1
- namespace_packages parameter is deprecated
- Pillow 10 deprecation warnings
- Array is incorrectly shifted for 96x16 OLEDs. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from luma.core.