@@ -1,42 +0,0 @@
1−# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2−# Copyright 2013 Canonical
3−#
4−# This program is free software: you can redistribute it and/or modify it
5−# under the terms of the GNU General Public License version 3, as published
6−# by the Free Software Foundation.
7−
8−from autopilot.matchers import Eventually
9−from testtools.matchers import Equals, NotEquals
10−from functools import wraps
11−import os.path
12−
13−from unity8 import get_lib_path
14−
15−
16−import logging
17−
18−logger = logging.getLogger(__name__)
19−
20−
21−def with_lightdm_mock(mock_type):
22− """A simple decorator that sets up the LightDM mock for a single test."""
23− def with_lightdm_mock_internal(fn):
24− @wraps(fn)
25− def wrapper(*args, **kwargs):
26− logger.info("Setting up LightDM mock type '%s'", mock_type)
27− lib_path = get_lib_path()
28− new_ld_library_path = os.path.join(
29− lib_path,
30− "qml/mocks/LightDM/",
31− mock_type
32− )
33− if not os.path.exists(new_ld_library_path):
34− raise RuntimeError(
35− "LightDM mock '%s' does not exist." % mock_type
36− )
37−
38− logger.info("New library path: %s", new_ld_library_path)
39− args[0].patch_environment('LD_LIBRARY_PATH', new_ld_library_path)
40− return fn(*args, **kwargs)
41− return wrapper
42− return with_lightdm_mock_internal