← Back to team overview

instant team mailing list archive

Patch for test scripts

 

Hi,

Please apply the attached patch which replaces the shell scripts under the
'tests' folder (run_tests.sh, rerun_tests.sh, and clean.sh) with
equivalent Python scripts for better cross-platform compatibility.

Johannes
# HG changeset patch
# User Johannes Ring <johannr@xxxxxxxxx>
# Date 1230541778 -3600
# Node ID 4df47c27389b801d3b7dc645c1cf6ef4a677d203
# Parent  da24a909c44d76d1011628e410947f31641b230b
Replaced sh test scripts with Python scripts for better cross-platform compatibility.

diff -r da24a909c44d -r 4df47c27389b tests/clean.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/clean.py	Mon Dec 29 10:09:38 2008 +0100
@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+
+import glob, shutil
+
+for d in glob.glob("test*cache") + glob.glob("*ext"):
+    shutil.rmtree(d)
diff -r da24a909c44d -r 4df47c27389b tests/clean.sh
--- a/tests/clean.sh	Mon Nov 17 11:38:00 2008 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-#!/bin/bash
-rm -rf test*cache
-rm -rf *ext
diff -r da24a909c44d -r 4df47c27389b tests/rerun_tests.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/rerun_tests.py	Mon Dec 29 10:09:38 2008 +0100
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+import os, sys, glob
+
+print "Not cleaning local test cache before tests."
+
+failed_tests = []
+for f in glob.glob("test*.py"):
+   print "Running test", f
+   failure = os.system("python " + f)
+   if failure:
+       failed_tests.append(f)
+
+if failed_tests:
+    print "\nThe following tests failed:"
+    for f in failed_tests:
+        print f
+    sys.exit(len(failed_tests1))
diff -r da24a909c44d -r 4df47c27389b tests/rerun_tests.sh
--- a/tests/rerun_tests.sh	Mon Nov 17 11:38:00 2008 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-#!/bin/sh 
-
-echo Not cleaning local test cache before tests.
-rm -f failed_tests
-
-for file in test*.py; do
-   echo "Running test $file ";
-   python $file;
-   if [ $? != 0 ]; then
-     echo $file >> failed_tests
-   fi
-done
-
-echo
-echo The following tests failed:
-cat failed_tests
-
diff -r da24a909c44d -r 4df47c27389b tests/run_tests.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/run_tests.py	Mon Dec 29 10:09:38 2008 +0100
@@ -0,0 +1,19 @@
+#!/usr/bin/env python 
+
+import os, sys, glob, shutil
+
+print "Cleaning local test cache before tests."
+os.system("python clean.py")
+
+failed_tests = []
+for f in glob.glob("test*.py"):
+    print "Running test", f
+    failure = os.system("python " + f)
+    if failure:
+        failed_tests.append(f)
+
+if failed_tests:
+    print "\nThe following tests failed:"
+    for f in failed_tests:
+        print f
+    sys.exit(len(failed_tests1))
diff -r da24a909c44d -r 4df47c27389b tests/run_tests.sh
--- a/tests/run_tests.sh	Mon Nov 17 11:38:00 2008 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-#!/bin/sh 
-
-echo Cleaning local test cache before tests.
-./clean.sh
-
-rm -f failed_tests
-
-for file in test*.py; do
-   echo "Running test $file ";
-   python $file;
-   if [ $? != 0 ]; then
-     echo $file >> failed_tests
-   fi
-done
-
-if [ -f failed_tests ]; then  
-  echo
-  echo The following tests failed:
-  cat failed_tests
-  exit 1
-fi
-exit 0

Follow ups