aboutsummaryrefslogtreecommitdiff
blob: eae9ca191819625bf78350d810bc1988e77bf6d3 (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
63
64
65
66
67
68
#	vim:fileencoding=utf-8
# (c) 2011 Michał Górny <mgorny@gentoo.org>
# Released under the terms of the 2-clause BSD license.

from .dbus_case import DBusEbuildTestCase

class InheritedVariableTest(DBusEbuildTestCase):
	""" INHERITED variable definition test. """

	phase_funcs = {
		'src_compile': [
			'pms-test-dbus_append_result "${INHERITED}"'
		]
	}

	def check_dbus_result(self, output, pm):
		DBusEbuildTestCase.check_dbus_result(self, output, pm)
		inherits = output[0].split()
		self.assertContains('pms-test-dbus', inherits,
				'INHERITED')

class RDependFallbackTest(DBusEbuildTestCase):
	""" Test whether RDEPEND=${DEPEND} fallback works as expected. """

	supported_eapis = (range(0, 4), (4,))
	ebuild_vars = {
		# that one shall be pretty portable
		'DEPEND': 'virtual/libc'
	}

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

		class DepMatcher(object):
			def __eq__(self, other):
				return other.key == str(self)

			def __str__(self):
				return 'virtual/libc'

			def __repr__(self):
				return repr(str(self))

		rdep = pm.installed[self.atom(pm)].run_dependencies
		mydep = DepMatcher()

		# in EAPI 4, expect empty RDEPEND
		# in older EAPIs, expect == DEPEND
		if self.eapi == 4:
			self.assertEqual(tuple(rdep), (), 'RDEPEND')
		else:
			self.assertContains(mydep, rdep, 'RDEPEND')

class DefinedPhasesTest(DBusEbuildTestCase):
	""" Test whether DEFINED_PHASES are declared in EAPI 4. """

	supported_eapis = ((4,),)
	phase_funcs = {
		'pkg_setup': [
			':'
		]
	}

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

		phases = pm.installed[self.atom(pm)].defined_phases
		self.assertEqual(tuple(phases), ('setup',), 'DEFINED_PHASES')