diff --git a/CHANGELOG.md b/CHANGELOG.md index 20746bf..e4e23dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Version 0.8.1 + +- refactor: drop `is_test_environment`, the code using headless kivy should be + responsible for setting up the environment so that it can fully customize the + configuration + ## Version 0.8.0 - refactor: use `str_to_bool` of `python-strtobool` instead of `strtobool` of `distutils` diff --git a/README.md b/README.md index 8444a1e..b5e5ae3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Kivy Headless Renderer for Raspberry Pi +# Kivy Headless Renderer This project uses the Kivy framework to create a headless renderer for a Raspberry Pi. The renderer is specifically designed for and tested with the diff --git a/headless_kivy_pi/__init__.py b/headless_kivy_pi/__init__.py index 1e48f11..761935a 100644 --- a/headless_kivy_pi/__init__.py +++ b/headless_kivy_pi/__init__.py @@ -12,6 +12,7 @@ To increase fps to `max_fps` call `activate_high_fps_mode`. """ + from __future__ import annotations import time @@ -60,8 +61,7 @@ class HeadlessWidget(Widget): def __init__(self: HeadlessWidget, **kwargs: dict[str, object]) -> None: """Initialize a `HeadlessWidget`.""" - if not config.is_test_environment(): - config.check_initialized() + config.check_initialized() self.should_ignore_hash = False diff --git a/headless_kivy_pi/config.py b/headless_kivy_pi/config.py index a4a2412..103c146 100644 --- a/headless_kivy_pi/config.py +++ b/headless_kivy_pi/config.py @@ -149,12 +149,7 @@ def setup_headless_kivy( from kivy.metrics import dp - if is_test_environment(): - Config.set('graphics', 'window_state', 'hidden') - from kivy.core.window import Window - - _display = Fake() - elif IS_RPI: + if IS_RPI: Config.set('graphics', 'window_state', 'hidden') # Configuration for CS and DC pins (these are PiTFT defaults): cs_pin = digitalio.DigitalInOut(board.CE0) @@ -253,14 +248,6 @@ def is_debug_mode() -> bool: report_uninitialized() -@cache -def is_test_environment() -> bool: - """Return `True` if the application is running in test environment.""" - import os - - return 'PYTEST_CURRENT_TEST' in os.environ - - @cache def double_buffering() -> bool: """Generate the next frame while sending the last frame to the display.""" diff --git a/pyproject.toml b/pyproject.toml index 3e39e10..6d5c925 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,13 @@ [tool.poetry] name = "headless-kivy-pi" -version = "0.8.0" -description = "Headless renderer for Kivy framework on Raspberry Pi" +version = "0.8.1" +description = "Headless renderer for Kivy framework" authors = ["Sassan Haradji "] license = "Apache-2.0" readme = "README.md" homepage = 'https://github.com/sassanh/headless-kivy-pi/' repository = 'https://github.com/sassanh/headless-kivy-pi/' -keywords = ['kivy', 'raspberry-pi', 'headless', 'display'] +keywords = ['kivy', 'headless', 'display', 'pytest'] packages = [ { include = "headless_kivy_pi" }, { include = "headless_kivy_pi_pytest" },