[PATCH] tests: render to offscreen surface and enable GUI unconditionally

2 views
Skip to first unread message

Yuya Nishihara

unread,
Jul 27, 2021, 7:49:18 AM7/27/21
to thg...@googlegroups.com
# HG changeset patch
# User Yuya Nishihara <yu...@tcha.org>
# Date 1627384425 -32400
# Tue Jul 27 20:13:45 2021 +0900
# Node ID 6a6556213f77230df230eb3096d4c96cb53d16a1
# Parent 14679e19f76c41a943370f6d33fe2ac65dc93efe
tests: render to offscreen surface and enable GUI unconditionally

We no longer need xvfb to redirect unwanted windows, and the tests should
run in headless environment.

diff --git a/tests/pytesthgenv.py b/tests/pytesthgenv.py
--- a/tests/pytesthgenv.py
+++ b/tests/pytesthgenv.py
@@ -106,17 +106,16 @@ class HgEnvPlugin(object):
os.environ['HGENCODINGMODE'] = 'strict'
# suppress "Session management error" on X11
os.environ['SESSION_MANAGER'] = ''
+ # render to offscreen surface to not show unwanted windows
+ os.environ['QT_QPA_PLATFORM'] = 'offscreen'

def _setupqapp(self):
- from tortoisehg.hgqt.qtcore import QCoreApplication, QSettings
+ from tortoisehg.hgqt.qtcore import QSettings
from tortoisehg.hgqt.qtgui import QApplication

# Make sure to hold single QApplication instance on memory. Multiple
# instances will lead crash.
- guienabled = (os.name == 'nt' or sys.platform == 'darwin'
- or bool(os.environ.get('DISPLAY')))
- appcls = [QCoreApplication, QApplication][guienabled]
- self._qapp = appcls([])
+ self._qapp = QApplication([])

# settings will be saved at $HGTMP/.config/TortoiseHg/TortoiseHgQt.ini
self._qapp.setApplicationName('TortoiseHgQt')

Reply all
Reply to author
Forward
0 new messages