Skip to content

Commit

Permalink
Merge a845e1a into e83867f
Browse files Browse the repository at this point in the history
  • Loading branch information
rm-hull committed Mar 1, 2020
2 parents e83867f + a845e1a commit 7d68ef2
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 48 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ cache: pip

matrix:
include:
- python: 2.7
env: TOXENV=py27
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36
- python: 3.7
env: TOXENV=py37
- python: 3.8-dev
- python: 3.8
env: TOXENV=py38
- python: 3.5
env: TOXENV=qa,doc

install: pip install --ignore-installed --upgrade setuptools pip tox coveralls
script: tox -vv
after_success: if [ "$TOXENV" == "py36" ]; then coveralls; fi
after_success: if [ "$TOXENV" == "py38" ]; then coveralls; fi
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Luma.Core
.. image:: https://img.shields.io/maintenance/yes/2020.svg?maxAge=2592000

**luma.core** is a component library providing a `Pillow <https://pillow.readthedocs.io/>`_-compatible
drawing canvas, and other functionality to support drawing primitives and
drawing canvas for Python 3, and other functionality to support drawing primitives and
text-rendering capabilities for small displays on the Raspberry Pi and other
single board computers:

Expand Down
2 changes: 1 addition & 1 deletion doc/intro.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Introduction
------------
**luma.core** is a component library providing a Pillow-compatible drawing
canvas, and other functionality to support drawing primitives and
canvas for Python 3, and other functionality to support drawing primitives and
text-rendering capabilities for small displays on the Raspberry Pi and other
single board computers:

Expand Down
10 changes: 2 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ def find_version(*file_paths):
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []
test_deps = [
'mock;python_version<"3.3"',
"pytest==4.5",
"pytest-cov"
]

install_deps = [
'pillow>=4.0.0',
'smbus2',
'pyftdi;python_version>="3.5"'
'pyftdi'
]

setup(
Expand All @@ -49,7 +48,7 @@ def find_version(*file_paths):
description=("A component library to support SBC display drivers"),
long_description="\n\n".join([README, CONTRIB, CHANGES]),
long_description_content_type="text/x-rst",
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4',
python_requires='>=3.5, <4',
license="MIT",
keywords="raspberry orange banana pi rpi opi sbc oled lcd led display screen spi i2c ftdi usb",
url=project_url,
Expand All @@ -68,9 +67,6 @@ def find_version(*file_paths):
':platform_system=="Linux"': [
'spidev', 'RPI.GPIO'
],
':python_version<"3.3"': [
'monotonic'
],
'docs': [
'sphinx>=1.5.1'
],
Expand All @@ -89,8 +85,6 @@ def find_version(*file_paths):
"Topic :: Education",
"Topic :: System :: Hardware",
"Topic :: System :: Hardware :: Hardware Drivers",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
Expand Down
7 changes: 0 additions & 7 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@

import os.path
import platform

try:
from unittest.mock import patch, call, Mock
except ImportError:
from mock import patch, call, Mock # noqa: F401

import pytest

from PIL import ImageChops, ImageFont
Expand All @@ -23,7 +17,6 @@
platform.system())
spidev_missing = 'spidev is not supported on this platform: {}'.format(
platform.system())
pyftdi_missing = 'pyftdi is not supported on Python {}'.format(platform.python_version())


def get_reference_file(fname):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_bitbang.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
Tests for the :py:class:`luma.core.interface.serial.bitbang` class.
"""

from unittest.mock import Mock, call
from luma.core.interface.serial import bitbang
import luma.core.error

import pytest

from helpers import Mock, call, rpi_gpio_missing
from helpers import rpi_gpio_missing


gpio = Mock(unsafe=True)
Expand Down
8 changes: 3 additions & 5 deletions tests/test_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

import pytest
import errno
import sys
from unittest.mock import patch, Mock

from luma.core import cmdline, error
from luma.core.interface.serial import __all__ as iface_types

from helpers import (get_reference_file, patch, Mock, i2c_error,
rpi_gpio_missing, spidev_missing, pyftdi_missing)
from helpers import (get_reference_file, i2c_error,
rpi_gpio_missing, spidev_missing)


test_config_file = get_reference_file('config-test.txt')
Expand Down Expand Up @@ -288,7 +288,6 @@ class args(test_spi_opts):
assert device == display_name


@pytest.mark.skipif(sys.version_info < (3, 5), reason=pyftdi_missing)
@patch('pyftdi.spi.SpiController')
def test_make_serial_ftdi_spi(mock_controller):
"""
Expand All @@ -304,7 +303,6 @@ class opts(test_spi_opts):
assert 'luma.core.interface.serial.spi' in repr(factory.ftdi_spi())


@pytest.mark.skipif(sys.version_info < (3, 5), reason=pyftdi_missing)
@patch('pyftdi.i2c.I2cController')
def test_make_serial_ftdi_i2c(mock_controller):
"""
Expand Down
9 changes: 2 additions & 7 deletions tests/test_ftdi_i2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
"""

import pytest
import sys
from unittest.mock import Mock, patch
from luma.core.interface.serial import ftdi_i2c
from helpers import Mock, patch, pyftdi_missing, fib
from helpers import fib
import luma.core.error


@pytest.mark.skipif(sys.version_info < (3, 5), reason=pyftdi_missing)
@patch('pyftdi.i2c.I2cController')
def test_init(mock_controller):
instance = Mock()
Expand All @@ -27,7 +26,6 @@ def test_init(mock_controller):
instance.get_port.assert_called_with(0xFF)


@pytest.mark.skipif(sys.version_info < (3, 5), reason=pyftdi_missing)
@patch('pyftdi.i2c.I2cController')
def test_command(mock_controller):
cmds = [3, 1, 4, 2]
Expand All @@ -41,7 +39,6 @@ def test_command(mock_controller):
port.write_to.assert_called_once_with(0x00, cmds)


@pytest.mark.skipif(sys.version_info < (3, 5), reason=pyftdi_missing)
@patch('pyftdi.i2c.I2cController')
def test_data(mock_controller):
data = list(fib(100))
Expand All @@ -55,7 +52,6 @@ def test_data(mock_controller):
port.write_to.assert_called_once_with(0x40, data)


@pytest.mark.skipif(sys.version_info < (3, 5), reason=pyftdi_missing)
@patch('pyftdi.i2c.I2cController')
def test_cleanup(mock_controller):
port = Mock()
Expand All @@ -68,7 +64,6 @@ def test_cleanup(mock_controller):
instance.terminate.assert_called_once_with()


@pytest.mark.skipif(sys.version_info < (3, 5), reason=pyftdi_missing)
@patch('pyftdi.i2c.I2cController')
def test_init_device_address_error(mock_controller):
address = 'foo'
Expand Down
9 changes: 2 additions & 7 deletions tests/test_ftdi_spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
Tests for the :py:class:`luma.core.interface.serial.ftdi_spi` class.
"""

import pytest
import sys
from unittest.mock import Mock, call, patch
from luma.core.interface.serial import ftdi_spi
from helpers import Mock, call, patch, pyftdi_missing, fib
from helpers import fib


@pytest.mark.skipif(sys.version_info < (3, 5), reason=pyftdi_missing)
@patch('pyftdi.spi.SpiController')
def test_init(mock_controller):
gpio = Mock()
Expand All @@ -30,7 +28,6 @@ def test_init(mock_controller):
gpio.set_direction.assert_called_with(0x60, 0x60)


@pytest.mark.skipif(sys.version_info < (3, 5), reason=pyftdi_missing)
@patch('pyftdi.spi.SpiController')
def test_command(mock_controller):
cmds = [3, 1, 4, 2]
Expand All @@ -47,7 +44,6 @@ def test_command(mock_controller):
port.write.assert_called_once_with(cmds)


@pytest.mark.skipif(sys.version_info < (3, 5), reason=pyftdi_missing)
@patch('pyftdi.spi.SpiController')
def test_data(mock_controller):
data = list(fib(100))
Expand All @@ -64,7 +60,6 @@ def test_data(mock_controller):
port.write.assert_called_once_with(data)


@pytest.mark.skipif(sys.version_info < (3, 5), reason=pyftdi_missing)
@patch('pyftdi.spi.SpiController')
def test_cleanup(mock_controller):
gpio = Mock()
Expand Down
3 changes: 2 additions & 1 deletion tests/test_gpio_cs_spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
"""

import pytest
from unittest.mock import Mock, call

from luma.core.interface.serial import gpio_cs_spi
import luma.core.error

from helpers import Mock, call, get_spidev, rpi_gpio_missing, fib
from helpers import get_spidev, rpi_gpio_missing, fib


spidev = Mock(unsafe=True)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_i2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
import errno
import pytest
import smbus2
from unittest.mock import Mock, patch, call
from luma.core.interface.serial import i2c
import luma.core.error

from helpers import Mock, patch, call, i2c_error, fib
from helpers import i2c_error, fib


smbus = Mock(unsafe=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from luma.core.legacy import text, textsize, show_message
from luma.core.legacy.font import proportional, CP437_FONT, LCD_FONT

from helpers import Mock, call
from unittest.mock import Mock, call


def test_textsize():
Expand Down
1 change: 0 additions & 1 deletion tests/test_legacy_fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import luma.core.legacy.font
from luma.core.legacy.font import proportional


import pytest
from helpers import get_reference_image, assert_identical_image

Expand Down
2 changes: 1 addition & 1 deletion tests/test_persist.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See LICENSE.rst for details.


from helpers import patch
from unittest.mock import patch

from luma.core.device import dummy

Expand Down
3 changes: 2 additions & 1 deletion tests/test_spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
"""

import pytest
from unittest.mock import Mock, call

from luma.core.interface.serial import spi
import luma.core.error

from helpers import Mock, call, get_spidev, rpi_gpio_missing, fib
from helpers import get_spidev, rpi_gpio_missing, fib


spidev = Mock(unsafe=True)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See LICENSE.rst for details.

[tox]
envlist = py{27,35,36,37,38},qa,doc
envlist = py{35,36,37,38},qa,doc
skip_missing_interpreters = True

[testenv]
Expand Down

0 comments on commit 7d68ef2

Please sign in to comment.