[libvirt] [test-API PATCH 2/2] parser: put the syntax checking to testcase line at end of flags checking
we use the re.match(.+:.+, tripped_casename) only check testcase name line, such as domain:start, we don't want it to check flag. placing it just after flags checking is right place. --- parser.py |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/parser.py b/parser.py index 18f6ccd..e569d7f 100644 --- a/parser.py +++ b/parser.py @@ -327,8 +327,6 @@ class CaseFileParser(object): tripped_caselist = casestring.strip().split() tripped_casename = tripped_caselist[0] -if not re.match(.+:.+, tripped_casename): -raise exception.CaseConfigfileError(casename line format error!) if self.debug: self.debug_print(we begin to handle the case, @@ -416,6 +414,9 @@ class CaseFileParser(object): list.append(option_case) continue +if not re.match(.+:.+, tripped_casename): +raise exception.CaseConfigfileError(%s line format error! % tripped_casename) + for caselist in list: newdict = {} newdict[tripped_casename] = {} -- 1.7.7.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [test-API PATCH 2/2] parser: put the syntax checking to testcase line at end of flags checking
On 04/13/2012 09:56 AM, Guannan Ren wrote: we use the re.match(.+:.+, tripped_casename) only check testcase name line, such as domain:start, we don't want it to check flag. placing it just after flags checking is right place. --- parser.py |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/parser.py b/parser.py index 18f6ccd..e569d7f 100644 --- a/parser.py +++ b/parser.py @@ -327,8 +327,6 @@ class CaseFileParser(object): tripped_caselist = casestring.strip().split() tripped_casename = tripped_caselist[0] -if not re.match(.+:.+, tripped_casename): -raise exception.CaseConfigfileError(casename line format error!) if self.debug: self.debug_print(we begin to handle the case, @@ -416,6 +414,9 @@ class CaseFileParser(object): list.append(option_case) continue +if not re.match(.+:.+, tripped_casename): +raise exception.CaseConfigfileError(%s line format error! % tripped_casename) + for caselist in list: newdict = {} newdict[tripped_casename] = {} I think both of these are fine, ACK series. Martin -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [test-API PATCH 2/2] parser: put the syntax checking to testcase line at end of flags checking
On 04/13/2012 08:59 PM, Martin Kletzander wrote: On 04/13/2012 09:56 AM, Guannan Ren wrote: we use the re.match(.+:.+, tripped_casename) only check testcase name line, such as domain:start, we don't want it to check flag. placing it just after flags checking is right place. --- parser.py |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/parser.py b/parser.py index 18f6ccd..e569d7f 100644 --- a/parser.py +++ b/parser.py @@ -327,8 +327,6 @@ class CaseFileParser(object): tripped_caselist = casestring.strip().split() tripped_casename = tripped_caselist[0] -if not re.match(.+:.+, tripped_casename): -raise exception.CaseConfigfileError(casename line format error!) if self.debug: self.debug_print(we begin to handle the case, @@ -416,6 +414,9 @@ class CaseFileParser(object): list.append(option_case) continue +if not re.match(.+:.+, tripped_casename): +raise exception.CaseConfigfileError(%s line format error! % tripped_casename) + for caselist in list: newdict = {} newdict[tripped_casename] = {} I think both of these are fine, ACK series. Martin Thanks, pushed Guannan Ren -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list