diff options
Diffstat (limited to 'src/test_interrupts.py')
-rw-r--r-- | src/test_interrupts.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/test_interrupts.py b/src/test_interrupts.py index 24f9bc3..ec7ad50 100644 --- a/src/test_interrupts.py +++ b/src/test_interrupts.py @@ -20,9 +20,8 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -__revision__ = "src/test_interrupts.py 4720 2010/03/24 03:14:11 jars" +__revision__ = "src/test_interrupts.py 5023 2010/06/14 22:05:46 scons" """ Verify that the SCons source code contains only correct handling of @@ -32,7 +31,6 @@ keyboard interrupts (e.g. Ctrl-C). import os import os.path import re -import string import time import TestSCons @@ -76,8 +74,8 @@ try: except IOError: test.skip_test('%s does not exist; skipping test.\n' % MANIFEST) else: - files = string.split(fp.read()) - files = filter(lambda f: f[-3:] == '.py', files) + files = fp.read().split() + files = [f for f in files if f[-3:] == '.py'] # some regexps to parse the python files tryexc_pat = re.compile( @@ -90,7 +88,7 @@ for f in files: contents = open(os.path.join(scons_lib_dir, f)).read() try_except_lines = {} lastend = 0 - while 1: + while True: match = tryexc_pat.search( contents, lastend ) if match is None: break @@ -100,7 +98,7 @@ for f in files: indent_list = try_except_lines[match.group('indent')] except: indent_list = [] - line_num = 1 + string.count(contents[:match.start()], '\n') + line_num = 1 + contents[:match.start()].count('\n') indent_list.append( (line_num, match.group('try_or_except') ) ) try_except_lines[match.group('indent')] = indent_list uncaught_this_file = [] @@ -111,7 +109,7 @@ for f in files: #print "%4d %s" % (l,statement), m1 = keyboardint_pat.match(statement) m2 = exceptall_pat.match(statement) - if string.find(statement, indent + 'try') == 0: + if statement.find(indent + 'try') == 0: if exc_all_seen and not exc_keyboardint_seen: uncaught_this_file.append(line) exc_keyboardint_seen = 0 |