summaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-xtests/runner.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 8feb83f9..318946e6 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -275,6 +275,18 @@ process(sys.argv[1])
print "Output: " + output[0]
return output[0]
+ # Tests that the given two paths are identical, modulo path delimiters. E.g. "C:/foo" is equal to "C:\foo".
+ def assertPathsIdentical(self, path1, path2):
+ path1 = path1.replace('\\', '/')
+ path2 = path2.replace('\\', '/')
+ return self.assertIdentical(path1, path2)
+
+ # Tests that the given two multiline text content are identical, modulo line ending differences (\r\n on Windows, \n on Unix).
+ def assertTextDataIdentical(self, text1, text2):
+ text1 = text1.replace('\r\n', '\n')
+ text2 = text2.replace('\r\n', '\n')
+ return self.assertIdentical(text1, text2)
+
def assertIdentical(self, values, y):
if type(values) not in [list, tuple]: values = [values]
for x in values:
@@ -766,11 +778,17 @@ an individual test with
except:
pass
+ numFailures = 0 # Keep count of the total number of failing tests.
+
# Run the discovered tests
if not len(suites):
print >> sys.stderr, 'No tests found for %s' % str(sys.argv[1:])
+ numFailures = 1
else:
testRunner = unittest.TextTestRunner(verbosity=2)
for suite in suites:
- testRunner.run(suite)
+ results = testRunner.run(suite)
+ numFailures += len(results.errors) + len(results.failures)
+ # Return the number of failures as the process exit code for automating success/failure reporting.
+ exit(numFailures)