On Wed, Oct 28, 2009 at 03:20:41AM -0400, Michael Goldish wrote:
> Thanks for catching this.
> While we're at it, why not remove the 2 occurrences of re.IGNORECASE
> that have no effect?

I just chose to ignore the code that does not break the tests.

I'd like to send a patch to remove the 2 're.IGNORECASE's and
use regex.search(o), as you recommended, to let Lucas to decide
the perferred way to fix. :-)

Thanks for your advice.

Cao, Chen
2009/10/28

> We can also replace re.search(regex, o) with the slightly shorter
> regex.search(o), but that's just a cosmetic change.
> 



> ----- Original Message -----
> From: "Chen Cao" <[email protected]>
> To: [email protected], [email protected]
> Cc: [email protected], "Chen Cao" <[email protected]>
> Sent: Tuesday, October 27, 2009 6:03:36 AM (GMT+0200) Auto-Detected
> Subject: [PATCH] KVM Test: Add re.IGNORECASE to re.compile to 
> verify_ip_address_ in kvm_utils.py
> 
> Since the mac address is (changed to) lowercase and the output of
> 'arping' is in uppercase, we need re.IGNORECASE in the re.compile.
> 
> (the re.IGNORECASE in the re.search function takes no effect on the
> compiled regex.)
> 
> Signed-off-by: Cao, Chen <[email protected]>
> ---
>  client/tests/kvm/kvm_utils.py |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
> index f72984a..934f223 100644
> --- a/client/tests/kvm/kvm_utils.py
> +++ b/client/tests/kvm/kvm_utils.py
> @@ -190,7 +190,7 @@ def verify_ip_address_ownership(ip, macs, timeout=10.0):
>      # Compile a regex that matches the given IP address and any of the given
>      # MAC addresses
>      mac_regex = "|".join("(%s)" % mac for mac in macs)
> -    regex = re.compile(r"\b%s\b.*\b(%s)\b" % (ip, mac_regex))
> +    regex = re.compile(r"\b%s\b.*\b(%s)\b" % (ip, mac_regex), re.IGNORECASE)
>  
>      # Check the ARP cache
>      o = commands.getoutput("/sbin/arp -n")
> -- 
> 1.6.0.6
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to