Skip to content

Commit

Permalink
unittests: Skip GUI test if no DISPLAY variable is set on Linux
Browse files Browse the repository at this point in the history
Skip the GUI test case on Linux if no suitable DISPLAY variable is set, so
the tests don't fail when run on a headless system.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
  • Loading branch information
tohojo committed Nov 2, 2022
1 parent 689f837 commit fa3a93d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions unittests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import unittest
import os
import sys

from .test_helpers import ForkingTestCase

Expand All @@ -40,6 +41,9 @@ def setUp(self):
except ImportError:
self.skipTest("No usable Qt module found")

if (sys.platform == 'linux' and not os.getenv("DISPLAY")):
self.skipTest("No DISPLAY variable set")

def test_start_gui(self):
from flent import gui
gui.run_gui(self.settings, test_mode=True)
Expand Down

0 comments on commit fa3a93d

Please sign in to comment.