X Server Management (functional_harness/x_server.py)

Wrapper for easily setting up and tearing down a test X server

_init_x_server(argv, verbose=False)[source]

Wrapper for starting an X server with the given command line

Parameters
  • argv (List[str]) – The command-line to execute

  • verbose (bool) – If False, redirect the X server’s stdout and stderr to /dev/null

Return type

Tuple[Popen, bytes]

Returns

The process object for the X server.

Raises

subprocess.CalledProcessError – The X server exited with an unexpected error.

x_server(argv, screens)[source]

Context manager to launch and then clean up an X server.

Parameters
  • argv (List[str]) – The command to launch the test X server and any arguments not relating to defining the attached screens.

  • screens (Dict[int, str]) – A dict mapping screen numbers to WxHxDEPTH strings. (eg. {0: '1024x768x32'})

Raises
  • subprocess.CalledProcessError – The X server or xauth failed unexpectedly.

  • FileNotFoundError – Could not find either the xauth command or argv[0].

  • PermissionError – Somehow, we lack write permission inside a directory created by tempfile.mkdtemp().

  • ValueErrorargv[0] was not an X server binary we know how to specify monitor rectangles for. (either Xvfb or Xephyr)

  • UnicodeDecodeError – The X server’s -displayfd option wrote a value to the given FD which could not be decoded as UTF-8 when it should have been part of the 7-bit ASCII subset of UTF-8.

Return type

Generator[Dict[str, str], None, None]