Platform manager and sanity tests for Linux

Signed-off-by: sweeneys <sweeneys@amazon.com>
This commit is contained in:
sweeneys
2021-10-08 15:36:52 -07:00
parent d3f6898ad6
commit 2034cd3053
9 changed files with 149 additions and 110 deletions
@@ -465,3 +465,17 @@ def close_windows_process(pid, timeout=20, raise_on_missing=False):
# Wait for asyncronous termination
waiter.wait_for(lambda: pid not in psutil.pids(), timeout=timeout,
exc=TimeoutError(f"Process {pid} never terminated"))
def get_display_env():
"""
Fetches environment variables with an appropriate display (monitor) configured,
useful for subprocess calls to UI applications
:return: A dictionary containing environment variables (per os.environ)
"""
env = os.environ.copy()
if not ly_test_tools.WINDOWS:
if 'DISPLAY' not in env.keys():
# assume Display 1 is available in another session
env['DISPLAY'] = ':1'
return env