20 """Set up and clean up fixtures for the Unity acceptance tests."""
31 class FakeScopes(fixtures.Fixture):
36 fixtures.EnvironmentVariable(
38 newvalue=self._get_fake_scopes_library_path()))
40 def _get_fake_scopes_library_path(self):
42 mock_path =
'qml/scopefakes/'
44 mock_path = os.path.join(
45 '../lib/', sysconfig.get_config_var(
'MULTIARCH'),
46 'unity8/qml/scopefakes/')
48 ld_library_path = os.path.abspath(os.path.join(lib_path, mock_path))
50 if not os.path.exists(ld_library_path):
52 'Expected library path does not exists: %s.' % (
54 return ld_library_path
57 class Tutorial(fixtures.Fixture):
59 def __init__(self, enable):
65 original_state = self._is_tutorial_enabled()
66 if self.enable != original_state:
67 self.addCleanup(self._set_tutorial, original_state)
68 self._set_tutorial(self.enable)
70 def _is_tutorial_enabled(self):
72 'dbus-send',
'--system',
'--print-reply',
73 '--dest=org.freedesktop.Accounts',
74 '/org/freedesktop/Accounts/User32011',
75 'org.freedesktop.DBus.Properties.Get',
76 'string:com.canonical.unity.AccountsService',
79 output = subprocess.check_output(command, universal_newlines=
True)
80 return True if output.count(
'true')
else False
82 def _set_tutorial(self, value):
83 value_string =
'true' if value
else 'false'
85 'dbus-send',
'--system',
'--print-reply',
86 '--dest=com.canonical.PropertyService',
87 '/com/canonical/PropertyService',
88 'com.canonical.PropertyService.SetProperty',
89 'string:edge',
'boolean:{}'.format(value_string)
91 subprocess.check_output(command)
def running_installed_tests()