aboutsummaryrefslogtreecommitdiff
blob: f95f090b4c58b54a8c4801ba51a46614aeaac68f (plain)
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
53
54
55
56
57
58
59
60
61
62
#	vim:fileencoding=utf-8
# (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
# Released under the terms of the 2-clause BSD license.

from .dbus_case import DBusEbuildDependencyTestCase
from .util import EbuildToucher, FailingEbuild

class DependTest(DBusEbuildDependencyTestCase):
	""" DEPEND fulfilling test. """

	depend_classes = [EbuildToucher]

	def __init__(self, *args, **kwargs):
		DBusEbuildDependencyTestCase.__init__(self, *args, **kwargs)
		self.phase_funcs['src_compile'].append(
			'pms-test-suite-%s || die' % self.dependant_ebuilds[0].pv
		)

class RDependTest(DBusEbuildDependencyTestCase):
	""" RDEPEND fulfilling test. """

	rdepend_classes = [EbuildToucher]

	def __init__(self, *args, **kwargs):
		DBusEbuildDependencyTestCase.__init__(self, *args, **kwargs)
		self.phase_funcs['pkg_postinst'].append(
			'pms-test-suite-%s || die' % self.dependant_ebuilds[0].pv
		)

class PDependTest(DBusEbuildDependencyTestCase):
	""" PDEPEND fulfilling test. """

	pdepend_classes = [EbuildToucher]

	def __init__(self, *args, **kwargs):
		DBusEbuildDependencyTestCase.__init__(self, *args, **kwargs)
		self.phase_funcs['pkg_postinst'].extend([
			'pms-test-suite-%s' % self.dependant_ebuilds[0].pv,
			'pms-test_dbus_append_result ${?}'
		])

	def check_dbus_result(self, output, pm):
		DBusEbuildDependencyTestCase.check_dbus_result(self, output, pm)

		try:
			res = output[0] == '0'
		except IndexError:
			res = None
		self.assertFalse(res, 'PDEP merged before ebuild',
				undefined = True)

class FailingDependTest(DBusEbuildDependencyTestCase):
	""" Unfulfilled DEPEND test. """

	depend_classes = [FailingEbuild]
	expect_failure = True

class FailingRDependTest(DBusEbuildDependencyTestCase):
	""" Unfulfilled RDEPEND test. """

	depend_classes = [FailingEbuild]
	expect_failure = True