From 3fa5c5c8e6fb16fab6a5ff0b1b24f0cb2a780614 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Thu, 24 May 2018 15:23:28 +0000 Subject: [PATCH] start fixing the shadow unit tests for win32 git-svn-id: https://xpra.org/svn/Xpra/trunk@19414 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- .../mixins/server_mixins_option_test_util.py | 47 ++++++++++--------- .../unit/server/mixins/shadow_option_test.py | 8 +++- src/unittests/unit/server_test_util.py | 6 ++- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/unittests/unit/server/mixins/server_mixins_option_test_util.py b/src/unittests/unit/server/mixins/server_mixins_option_test_util.py index 40dfcd9d95..06f3f80020 100755 --- a/src/unittests/unit/server/mixins/server_mixins_option_test_util.py +++ b/src/unittests/unit/server/mixins/server_mixins_option_test_util.py @@ -7,7 +7,7 @@ import time from collections import OrderedDict -from xpra.os_util import pollwait +from xpra.os_util import pollwait, WIN32 from unit.server_test_util import ServerTestUtil, log @@ -32,28 +32,31 @@ class ServerMixinsOptionTestUtil(ServerTestUtil): @classmethod def setUpClass(cls): ServerTestUtil.setUpClass() - cls.default_xpra_args = [ - "--systemd-run=no", - "--pulseaudio=no", - "--socket-dirs=/tmp", - "--start=xterm", - ] + cls.default_xpra_args = [] + if not WIN32: + cls.default_xpra_args = [ + "--systemd-run=no", + "--pulseaudio=no", + "--socket-dirs=/tmp", + "--start=xterm", + ] cls.display = None cls.xvfb = None cls.client_display = None cls.client_xvfb = None - if False: - #use a single display for the server that we recycle: - cls.display = cls.find_free_display() - cls.xvfb = cls.start_Xvfb(cls.display) - time.sleep(1) - assert cls.display in cls.find_X11_displays() - log("ServerMixinsOptionTest.setUpClass() server display=%s, xvfb=%s", cls.display, cls.xvfb) - if True: - #display used by the client: - cls.client_display = cls.find_free_display() - cls.client_xvfb = cls.start_Xvfb(cls.client_display) - log("ServerMixinsOptionTest.setUpClass() client display=%s, xvfb=%s", cls.client_display, cls.client_xvfb) + if not WIN32: + if False: + #use a single display for the server that we recycle: + cls.display = cls.find_free_display() + cls.xvfb = cls.start_Xvfb(cls.display) + time.sleep(1) + assert cls.display in cls.find_X11_displays() + log("ServerMixinsOptionTest.setUpClass() server display=%s, xvfb=%s", cls.display, cls.xvfb) + if True: + #display used by the client: + cls.client_display = cls.find_free_display() + cls.client_xvfb = cls.start_Xvfb(cls.client_display) + log("ServerMixinsOptionTest.setUpClass() client display=%s, xvfb=%s", cls.client_display, cls.client_xvfb) @classmethod @@ -68,7 +71,9 @@ def _test(self, subcommand="start", options={}): log("starting test server with options=%s", options) args = ["--%s=%s" % (k,v) for k,v in options.items()] xvfb = None - if self.display: + if WIN32: + display = ":0" + elif self.display: display = self.display args.append("--use-display") else: @@ -90,7 +95,7 @@ def _test(self, subcommand="start", options={}): r = pollwait(client, 5) assert r==0, "info client failed and returned %s for server with args=%s" % (r, args) #connect a gui client: - if self.client_display and self.client_xvfb: + if WIN32 or (self.client_display and self.client_xvfb): xpra_args = ["attach", display] gui_client = self.run_xpra(xpra_args, {"DISPLAY" : self.client_display}) r = pollwait(gui_client, 5) diff --git a/src/unittests/unit/server/mixins/shadow_option_test.py b/src/unittests/unit/server/mixins/shadow_option_test.py index 9a1fafe161..8fb72ece54 100755 --- a/src/unittests/unit/server/mixins/shadow_option_test.py +++ b/src/unittests/unit/server/mixins/shadow_option_test.py @@ -16,7 +16,13 @@ def test_start_all(self): def main(): - unittest.main() + from xpra.os_util import WIN32 + if not WIN32: + unittest.main() + #for running on win32: + #XPRA_WAIT_FOR_INPUT=0 XPRA_COMMAND=../scripts/xpra \ + # PYTHONPATH=".;.." XPRA_TEST_DEBUG=1 XPRA_ALL_DEBUG=1 \ + # ./unit/server/mixins/shadow_option_test.py if __name__ == '__main__': diff --git a/src/unittests/unit/server_test_util.py b/src/unittests/unit/server_test_util.py index 4e6acc75ca..80ad301aae 100755 --- a/src/unittests/unit/server_test_util.py +++ b/src/unittests/unit/server_test_util.py @@ -11,7 +11,7 @@ import unittest import subprocess from xpra.util import envbool, envint, repr_ellipsized -from xpra.os_util import OSEnvContext, pollwait, osexpand, POSIX +from xpra.os_util import OSEnvContext, pollwait, osexpand, POSIX, WIN32 from xpra.scripts.config import get_defaults from xpra.platform.dotxpra import DotXpra from xpra.platform.paths import get_xpra_command @@ -42,7 +42,9 @@ def setUpClass(cls): cls.default_config = get_defaults() cls.display_start = 100 cls.dotxpra = DotXpra("/tmp", ["/tmp"]) - cls.default_xpra_args = ["--systemd-run=no", "--pulseaudio=no", "--socket-dirs=/tmp", "--speaker=no", "--microphone=no"] + cls.default_xpra_args = ["--speaker=no", "--microphone=no"] + if not WIN32: + cls.default_xpra_args += ["--systemd-run=no", "--pulseaudio=no", "--socket-dirs=/tmp"] ServerTestUtil.existing_displays = cls.displays() ServerTestUtil.processes = [] xpra_list = cls.run_xpra(["list"])