From 717285060ec6838ebed07569cd5faecc4fb637b8 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Fri, 27 Jan 2012 11:16:35 +0000 Subject: [PATCH] Use explicit for loop to find section in testing. --- IPython/testing/iptest.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index a4622bcf9..9040cb166 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -287,7 +287,12 @@ class IPTester(object): # Assemble call self.call_args = self.runner+self.params - sect = [p for p in self.params if p.startswith('IPython')][0] + # Find the section we're testing (IPython.foo) + for sect in self.params: + if sect.startswith('IPython'): break + else: + raise ValueError("Section not found", self.params) + if '--with-xunit' in self.call_args: self.call_args.append('--xunit-file=%s' % path.abspath(sect+'.xunit.xml'))