| |
- ensureDisplayPresent(xvfbStartNum=50, xvfbLastNum=99, screenStr='1280x720x24')
- ensureDisplayPresent - Ensure we have either DISPLAY env var set,
or we attempt to start an Xvfb session via startXvfbRange
@param xvfbStartNum <int> Default 50 - If DISPLAY is not set,
try to start Xvfb from here to #xvfbLastNum inclusive
@param xvfbLastNum <int> Default 99 - If DISPLAY is not set,
try to start Xvfb from #xvfbStartNum to here inclusive
@param screenStr <str> Default DEFAULT_SCREEN_STR - If DISPLAY
is not set, try to start Xvfb using this screen configuration
NOTE: This will set the environment variable 'DISPLAY' if not already set
@return <bool> - True if we did setup an Xvfb and set DISPLAY,
False if we use existing DISPLAY
- getDisplayStrForServerNum(serverNum)
- getDisplayStrForServerNum - Gets the DISPLAY string for a given
server number
@param serverNum <int> - Server number
@return <str> - The DISPLAY string that references the given session
- isUsingXvfb(serverNum=None)
- isUsingXvfb - Test if we are using Xvfb,
optionally at a specific server number
@param serverNum <None/int> Default None - If None, tests if
we have ANY Xvfb sessions managed.
If an int, tests at a specific server number
@return <bool> - True if we are managing Xvfb, otherwise False
- registerAtExitCleanup()
- registerAtExitCleanup - Register an "at exit" handler which will
cleanup/close any Xvfb sessions we are managing
- startXvfb(serverNum, screenStr='1280x720x24')
- startXvfb - Starts a managed Xvfb session at a given server num
@param serverNum <int> - Server number
@param screenStr <str> Default '1280x720x24' -
Screen configuration for this Xvfb
@return True
@raises -
ValueError - We are already managing an Xvfb on #serverNum
KeyError - Failed to start Xvfb on #serverNum because #serverNum
already in use
OSError - Failed to start Xvfb on #serverNum for reason
other than #serverNum in use
Exception str will contain exit code and output
- startXvfbRange(startTryNum, lastTryNum, screenStr='1280x720x24')
- startXvfbRange - Try to start an Xvfb using a range of possible
server numbers. Use this if multiple instances of Xvfb sessions could
be running.
@param startTryNum <int> - The first server num to attempt
@param lastTryNum <int> - The last server num to attempt
@param screenStr <str> Default '1280x720x24' - The screen configuration to use
@return <int> - The server num we succeded on starting a
Xvfb session.
@raises -
KeyError - Could not start an Xvfb session on any
server num in range because all were
in use.
OSError - Could not start an Xvfb session because
Xvfb crashed for a reason other than
another session is active on serverNum
- stopAllManagedXvfbs()
- stopAllManagedXvfbs - Stops all Xvfb's managed by this process
@return <int> - The number of Xvfb's stopped
- stopXvfb(serverNum)
- stopXvfb - Stops a managed Xvfb session on a given server number
@param serverNum <int> - The server number
@return <bool> - True on success,
False if there was no managed session on #serverNum
|