Unity 8
 All Classes Functions Properties
fixture_setup.py
1 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2 #
3 # Unity Autopilot Test Suite
4 # Copyright (C) 2014 Canonical
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #
19 
20 """Set up and clean up fixtures for the Unity acceptance tests."""
21 
22 import os
23 import sysconfig
24 
25 import fixtures
26 
27 import unity8
28 
29 
30 class FakeScopes(fixtures.Fixture):
31 
32  def setUp(self):
33  super(FakeScopes, self).setUp()
34  self.useFixture(
35  fixtures.EnvironmentVariable(
36  'QML2_IMPORT_PATH',
37  newvalue=self._get_fake_scopes_library_path()))
38 
39  def _get_fake_scopes_library_path(self):
41  mock_path = 'qml/scopefakes/'
42  else:
43  mock_path = os.path.join(
44  '../lib/', sysconfig.get_config_var('MULTIARCH'),
45  'unity8/qml/scopefakes/')
46  lib_path = unity8.get_lib_path()
47  ld_library_path = os.path.abspath(os.path.join(lib_path, mock_path))
48 
49  if not os.path.exists(ld_library_path):
50  raise RuntimeError(
51  'Expected library path does not exists: %s.' % (
52  ld_library_path))
53  return ld_library_path
def running_installed_tests
Definition: __init__.py:27
def get_lib_path
Definition: __init__.py:32