From 823b72d4f149466285026c6ae4e62fa13d0e6520 Mon Sep 17 00:00:00 2001 From: Sassan Haradji Date: Fri, 15 Mar 2024 02:57:42 +0400 Subject: [PATCH] fix: don't interact with window system when running headless for tests --- CHANGELOG.md | 4 ++++ headless_kivy_pi/config.py | 7 ++++--- pyproject.toml | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca478ff..5837b74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Version 0.7.1 + +- fix: don't interact with window system when running headless for tests + ## Version 0.7.0 - feat: render relevant parts of the screen only diff --git a/headless_kivy_pi/config.py b/headless_kivy_pi/config.py index 048a59e..2eaaadb 100644 --- a/headless_kivy_pi/config.py +++ b/headless_kivy_pi/config.py @@ -134,13 +134,14 @@ def setup_headless_kivy(config: SetupHeadlessConfig) -> None: {BITS_PER_BYTE}))""" raise ValueError(msg) + from kivy.metrics import dp + if is_test_environment(): Config.set('graphics', 'window_state', 'hidden') from kivy.core.window import Window - from kivy.metrics import dp - - if IS_RPI: + _display = Fake() + elif IS_RPI: Config.set('graphics', 'window_state', 'hidden') # Configuration for CS and DC pins (these are PiTFT defaults): cs_pin = digitalio.DigitalInOut(board.CE0) diff --git a/pyproject.toml b/pyproject.toml index f4c81c8..7a32cbf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "headless-kivy-pi" -version = "0.7.0" +version = "0.7.1" description = "Headless renderer for Kivy framework on Raspberry Pi" authors = ["Sassan Haradji "] license = "Apache-2.0"