Skip to content

Commit

Permalink
Merge 54a83cc into f832df4
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Oct 13, 2020
2 parents f832df4 + 54a83cc commit 19257b1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions luma/emulator/render.py
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) 2017-2020 Richard Hull and contributors
# See LICENSE.rst for details.

import os
from pathlib import Path


__all__ = ["transformer"]
Expand All @@ -17,9 +17,9 @@ def __init__(self, pygame, width, height, scale):
self._input_size = (width, height)
self._output_size = (width * scale, height * scale)
self._scale = scale
base_dir = os.path.dirname(__file__)
base_dir = Path(__file__).resolve().parent
self._led_on, self._led_off, self._sevenseg = \
[self._pygame.image.load(os.path.join(base_dir, "images", img))
[self._pygame.image.load(str(base_dir.joinpath("images", img)))
for img in ["led_on.png", "led_off.png", "7-segment.png"]]

def none(self, surface):
Expand Down
18 changes: 11 additions & 7 deletions tests/helpers.py
Expand Up @@ -2,11 +2,11 @@
# Copyright (c) 2017-2020 Richard Hull and contributors
# See LICENSE.rst for details.

from contextlib import contextmanager
import hashlib
import os.path
import sys
import hashlib
from pathlib import Path
from io import StringIO
from contextlib import contextmanager


def md5(fname):
Expand All @@ -15,10 +15,14 @@ def md5(fname):


def get_reference_image(fname):
return os.path.abspath(os.path.join(
os.path.dirname(__file__),
'reference',
fname))
"""
Get absolute path for ``fname``.
:param fname: Filename.
:type fname: str or pathlib.Path
:rtype: str
"""
return str(Path(__file__).resolve().parent.joinpath('reference', fname))


def assert_identical(rname, fname):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_gifanim.py
Expand Up @@ -7,7 +7,7 @@
Tests for :py:class:`luma.emulator.device.gifanim`.
"""

import os.path
from pathlib import Path
from tempfile import NamedTemporaryFile

from PIL import Image
Expand Down Expand Up @@ -44,7 +44,7 @@ def test_gifanim_noimages():
fname = temp.name
device = gifanim(filename=fname)
device.write_animation()
assert not os.path.exists(fname)
assert not Path(fname).exists()


def test_gifanim_max_frames():
Expand Down

0 comments on commit 19257b1

Please sign in to comment.