[Python-checkins] r55607 - python/branches/bcannon-objcap/run_security_tests.py
brett.cannon
python-checkins at python.org
Sun May 27 07:03:04 CEST 2007
Author: brett.cannon
Date: Sun May 27 07:03:03 2007
New Revision: 55607
Modified:
python/branches/bcannon-objcap/run_security_tests.py
Log:
Fix result detection for 'fail' tests.
Modified: python/branches/bcannon-objcap/run_security_tests.py
==============================================================================
--- python/branches/bcannon-objcap/run_security_tests.py (original)
+++ python/branches/bcannon-objcap/run_security_tests.py Sun May 27 07:03:03 2007
@@ -1,5 +1,6 @@
import subprocess
import os
+import re
def run_tests(type_, test_verifier):
failures = []
@@ -22,18 +23,23 @@
return failures
+debug_refs_regex = re.compile(r"^\[\d+ refs\]$")
+
def verify_succeed_test(test_name, stderr):
- if stderr.count('\n') > 1:
+ """Should only have debug build output.
+
+ Does not work for non-debug builds!
+
+ """
+ if not debug_refs_regex.match(stderr):
return False
- else:
- return True
+ return True
def verify_fail_test(test_name, stderr):
- if stderr.count('\n') <= 1:
- return False
+ """Should have an exception line with the proper exception raised."""
exc_name = test_name.split('--')[1]
- if exc_name not in stderr:
+ if not re.search('^'+exc_name, stderr, re.MULTILINE):
return False
return True
More information about the Python-checkins
mailing list