Merge lp:~longbow/kewpie/opt-matrix-optreq into lp:kewpie

Proposed by Valentine Gostev
Status: Merged
Merged at revision: 121
Proposed branch: lp:~longbow/kewpie/opt-matrix-optreq
Merge into: lp:kewpie
Diff against target: 31 lines (+18/-6)
1 file modified
lib/opts/matrix_manager.py (+18/-6)
To merge this branch: bzr merge lp:~longbow/kewpie/opt-matrix-optreq
Reviewer Review Type Date Requested Status
Patrick Crews Pending
Review via email: mp+94124@code.launchpad.net

Description of the change

Added validator to ensure all required options were given for test.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/opts/matrix_manager.py'
2--- lib/opts/matrix_manager.py 2012-02-20 20:49:50 +0000
3+++ lib/opts/matrix_manager.py 2012-02-22 11:21:22 +0000
4@@ -26,9 +26,21 @@
5 class matrixManager:
6 def __init__(self, variables):
7 if not variables['optmatrix']:
8- return None
9- matrix_list=[]
10- for i in variables['optmatrix'].split(','):
11- option_tuple = i.split('=')[0], i.split('=')[1]
12- matrix_list.append(option_tuple)
13- self.option_matrix = dict(matrix_list)
14+ matrix_list=[]
15+ for i in variables['optmatrix'].split(','):
16+ option_tuple = i.split('=')[0], i.split('=')[1]
17+ matrix_list.append(option_tuple)
18+ self.option_matrix = dict(matrix_list)
19+
20+
21+ def matrix_check_req(self, matrix_reqlist):
22+ """Check requirements method assures that options required
23+ for test were provided to --opt-matrix
24+
25+ """
26+ while matrix_reqlist != []:
27+ req_shift = matrix_reqlist.pop()
28+ if not self.option_matrix[req_shift]:
29+ raise KeyError('The required option %s missing from opt-matrix' %(req_shift))
30+
31+

Subscribers

People subscribed via source and target branches