1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# vim:fileencoding=utf-8
# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
# Released under the terms of the 2-clause BSD license.
import os.path
from .dbus_case import DBusEbuildTestCase
from .ext_cases import DBusFetchingEbuildTestCase
class AATest(DBusFetchingEbuildTestCase):
""" Test whether AA is declared. """
supported_eapis = (range(0, 4), (4,))
ebuild_vars = {
'IUSE': 'pms_tests_magical_hidden_use' # XXX?
}
phase_funcs = {
'src_unpack': [
'pms-test_dbus_append_result "${AA}"'
]
}
def __init__(self, *args, **kwargs):
DBusFetchingEbuildTestCase.__init__(self, *args, **kwargs)
self._expect_fn = os.path.split(self.ebuild_vars['SRC_URI'])[1]
self.ebuild_vars['SRC_URI'] = 'pms_tests_magical_hidden_use? ( %s )' \
% self.ebuild_vars['SRC_URI']
def check_dbus_result(self, output, pm):
if self.eapi < 4:
expect = self._expect_fn
else:
expect = ''
DBusEbuildTestCase.check_dbus_result(self, output, pm)
self.assertEqual(output[0], expect, '${AA}')
class KVTest(DBusEbuildTestCase):
""" Test whether KV is declared. """
supported_eapis = (range(0, 4), (4,))
phase_funcs = {
'src_compile': [
'pms-test_dbus_append_result "${KV}"'
]
}
def check_dbus_result(self, output, pm):
DBusEbuildTestCase.check_dbus_result(self, output, pm)
func = self.assertEqual if self.eapi == 4 \
else self.assertNotEqual
func(output[0], '', '${KV}')
|