1 |
commit: c5b0f3d8c096765695be2a01208175d88a183da6 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 25 20:35:07 2011 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 31 18:01:32 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=c5b0f3d8 |
7 |
|
8 |
Adjust the phase function order test to the new API. |
9 |
|
10 |
--- |
11 |
basic/phase-function-order.py | 75 ----------------------------------------- |
12 |
basic/phase_function_order.py | 47 +++++++++++++++++++++++++ |
13 |
2 files changed, 47 insertions(+), 75 deletions(-) |
14 |
|
15 |
diff --git a/basic/phase-function-order.py b/basic/phase-function-order.py |
16 |
deleted file mode 100644 |
17 |
index 01e71c9..0000000 |
18 |
--- a/basic/phase-function-order.py |
19 |
+++ /dev/null |
20 |
@@ -1,75 +0,0 @@ |
21 |
-# Example Python implementation |
22 |
- |
23 |
-# XXX: will be implemented in core suite and imported here |
24 |
-class EbuildTest(object): |
25 |
- phase_funcs = dict([(func, []) for func in ( |
26 |
- 'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare', |
27 |
- 'src_configure', 'src_compile', 'src_install', |
28 |
- 'pkg_preinst', 'pkg_postinst' |
29 |
- )]) |
30 |
- |
31 |
-class PhaseFunctionOrderTest(EbuildTest): |
32 |
- relevant_eapis = (0, 2, 4) |
33 |
- |
34 |
- ebuild_vars = { |
35 |
- 'DESCRIPTION': 'Phase function execution order test' |
36 |
- } |
37 |
- |
38 |
- def __init__(self): |
39 |
- for func in self.phase_funcs.keys(): |
40 |
- self.phase_funcs[func].append("pms-test_append_result %s" % func) |
41 |
- |
42 |
- def check_output(self, output): |
43 |
- if self.EAPI < 2: |
44 |
- expect = """pkg_setup |
45 |
-src_unpack |
46 |
-src_compile |
47 |
-src_install |
48 |
-pkg_preinst |
49 |
-pkg_postinst""" |
50 |
- elif self.EAPI < 4: |
51 |
- expect = """pkg_setup |
52 |
-src_unpack |
53 |
-src_prepare |
54 |
-src_compile |
55 |
-src_configure |
56 |
-src_install |
57 |
-pkg_preinst |
58 |
-pkg_postinst""" |
59 |
- else: |
60 |
- expect = """pkg_pretend |
61 |
-pkg_setup |
62 |
-src_unpack |
63 |
-src_prepare |
64 |
-src_compile |
65 |
-src_configure |
66 |
-src_install |
67 |
-pkg_preinst |
68 |
-pkg_postinst""" |
69 |
- |
70 |
- return (output == expect) |
71 |
- |
72 |
-# (test code) |
73 |
-test = PhaseFunctionOrderTest() |
74 |
- |
75 |
-test.EAPI=1 |
76 |
-real_output="""pkg_setup |
77 |
-src_unpack |
78 |
-src_compile |
79 |
-src_install |
80 |
-pkg_preinst |
81 |
-pkg_postinst""" |
82 |
-print(test.check_output(real_output)) # expect True |
83 |
- |
84 |
-test.EAPI=2 |
85 |
-print(test.check_output(real_output)) # expect False |
86 |
- |
87 |
-real_output="""pkg_setup |
88 |
-src_unpack |
89 |
-src_prepare |
90 |
-src_compile |
91 |
-src_configure |
92 |
-src_install |
93 |
-pkg_preinst |
94 |
-pkg_postinst""" |
95 |
-print(test.check_output(real_output)) # expect True |
96 |
|
97 |
diff --git a/basic/phase_function_order.py b/basic/phase_function_order.py |
98 |
new file mode 100644 |
99 |
index 0000000..7a9cc13 |
100 |
--- /dev/null |
101 |
+++ b/basic/phase_function_order.py |
102 |
@@ -0,0 +1,47 @@ |
103 |
+# vim:fileencoding=utf-8 |
104 |
+# (c) 2011 Michał Górny <mgorny@g.o> |
105 |
+# Released under the terms of the 2-clause BSD license. |
106 |
+ |
107 |
+from PMSTestSuite.library.case import EbuildTestCase |
108 |
+ |
109 |
+class PhaseFunctionOrderTest(EbuildTestCase): |
110 |
+ relevant_eapis = (0, 2, 4) |
111 |
+ |
112 |
+ ebuild_vars = { |
113 |
+ 'DESCRIPTION': 'Phase function execution order test' |
114 |
+ } |
115 |
+ |
116 |
+ def __init__(self, *args, **kwargs): |
117 |
+ for func in self.phase_funcs: |
118 |
+ self.phase_funcs[func].append("pms-test_append_result %s" % func) |
119 |
+ EbuildTestCase.__init__(self, *args, **kwargs) |
120 |
+ |
121 |
+ def check_output(self, output): |
122 |
+ if self.eapi < 2: |
123 |
+ expect = """pkg_setup |
124 |
+src_unpack |
125 |
+src_compile |
126 |
+src_install |
127 |
+pkg_preinst |
128 |
+pkg_postinst""" |
129 |
+ elif self.eapi < 4: |
130 |
+ expect = """pkg_setup |
131 |
+src_unpack |
132 |
+src_prepare |
133 |
+src_compile |
134 |
+src_configure |
135 |
+src_install |
136 |
+pkg_preinst |
137 |
+pkg_postinst""" |
138 |
+ else: |
139 |
+ expect = """pkg_pretend |
140 |
+pkg_setup |
141 |
+src_unpack |
142 |
+src_prepare |
143 |
+src_compile |
144 |
+src_configure |
145 |
+src_install |
146 |
+pkg_preinst |
147 |
+pkg_postinst""" |
148 |
+ |
149 |
+ return (output == expect) |