diff --git a/tests2/accesstests.py b/tests2/accesstests.py index 7ede6dcd..d4c3455b 100755 --- a/tests2/accesstests.py +++ b/tests2/accesstests.py @@ -659,10 +659,12 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(suite) + return result + if __name__ == '__main__': # Add the build directory to the path so we're testing the latest build, not the installed version. add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests2/dbapitests.py b/tests2/dbapitests.py index c69c2e35..a2fd8c2e 100755 --- a/tests2/dbapitests.py +++ b/tests2/dbapitests.py @@ -1,4 +1,4 @@ - +import sys import unittest from testutils import * import dbapi20 @@ -38,6 +38,8 @@ def test_ExceptionsAsConnectionAttributes(self): pass testRunner = unittest.TextTestRunner(verbosity=(options.verbose > 1) and 9 or 0) result = testRunner.run(suite) + return result + + if __name__ == '__main__': - main() - + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests2/exceltests.py b/tests2/exceltests.py index b2993ffc..a20f5c5d 100755 --- a/tests2/exceltests.py +++ b/tests2/exceltests.py @@ -131,10 +131,12 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(suite) + return result + if __name__ == '__main__': # Add the build directory to the path so we're testing the latest build, not the installed version. add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests2/informixtests.py b/tests2/informixtests.py index fb838e30..765c9fae 100755 --- a/tests2/informixtests.py +++ b/tests2/informixtests.py @@ -1261,6 +1261,8 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(suite) + return result + if __name__ == '__main__': @@ -1269,4 +1271,4 @@ def main(): add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests2/mysqltests.py b/tests2/mysqltests.py index bf8aa94d..b8b3eda9 100755 --- a/tests2/mysqltests.py +++ b/tests2/mysqltests.py @@ -748,6 +748,8 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(suite) + return result + if __name__ == '__main__': @@ -756,4 +758,4 @@ def main(): add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests2/pgtests.py b/tests2/pgtests.py index e58d1179..3cf092ff 100755 --- a/tests2/pgtests.py +++ b/tests2/pgtests.py @@ -571,6 +571,9 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(s) + return result + + if __name__ == '__main__': # Add the build directory to the path so we're testing the latest build, not the installed version. @@ -578,4 +581,4 @@ def main(): add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests2/sqldwtests.py b/tests2/sqldwtests.py index fa85359b..b4f785f2 100644 --- a/tests2/sqldwtests.py +++ b/tests2/sqldwtests.py @@ -1485,6 +1485,8 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(suite) + return result + if __name__ == '__main__': @@ -1493,4 +1495,4 @@ def main(): add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests2/sqlitetests.py b/tests2/sqlitetests.py index b1cddc1f..b402d19e 100755 --- a/tests2/sqlitetests.py +++ b/tests2/sqlitetests.py @@ -709,7 +709,7 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(suite) - sys.exit(result.errors and 1 or 0) + return result if __name__ == '__main__': @@ -719,4 +719,4 @@ def main(): add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests2/sqlservertests.py b/tests2/sqlservertests.py index 3ffbbcfb..2296aa79 100755 --- a/tests2/sqlservertests.py +++ b/tests2/sqlservertests.py @@ -1896,6 +1896,8 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(suite) + return result + if __name__ == '__main__': @@ -1904,4 +1906,4 @@ def main(): add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests3/accesstests.py b/tests3/accesstests.py index 9142c6f1..ff389a12 100644 --- a/tests3/accesstests.py +++ b/tests3/accesstests.py @@ -616,10 +616,12 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=args.verbose) result = testRunner.run(suite) + return result + if __name__ == '__main__': # Add the build directory to the path so we're testing the latest build, not the installed version. add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests3/dbapitests.py b/tests3/dbapitests.py index c69c2e35..a2fd8c2e 100644 --- a/tests3/dbapitests.py +++ b/tests3/dbapitests.py @@ -1,4 +1,4 @@ - +import sys import unittest from testutils import * import dbapi20 @@ -38,6 +38,8 @@ def test_ExceptionsAsConnectionAttributes(self): pass testRunner = unittest.TextTestRunner(verbosity=(options.verbose > 1) and 9 or 0) result = testRunner.run(suite) + return result + + if __name__ == '__main__': - main() - + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests3/exceltests.py b/tests3/exceltests.py index b2993ffc..a20f5c5d 100644 --- a/tests3/exceltests.py +++ b/tests3/exceltests.py @@ -131,10 +131,12 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(suite) + return result + if __name__ == '__main__': # Add the build directory to the path so we're testing the latest build, not the installed version. add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests3/informixtests.py b/tests3/informixtests.py index 663ddb39..4b96af12 100644 --- a/tests3/informixtests.py +++ b/tests3/informixtests.py @@ -1250,6 +1250,8 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(suite) + return result + if __name__ == '__main__': @@ -1258,4 +1260,4 @@ def main(): add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests3/mysqltests.py b/tests3/mysqltests.py index f5871472..f818704e 100755 --- a/tests3/mysqltests.py +++ b/tests3/mysqltests.py @@ -779,6 +779,8 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(suite) + return result + if __name__ == '__main__': @@ -787,4 +789,4 @@ def main(): add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests3/pgtests.py b/tests3/pgtests.py index b64ca3a4..1b16a280 100755 --- a/tests3/pgtests.py +++ b/tests3/pgtests.py @@ -19,6 +19,7 @@ Note: Be sure to use the "Unicode" (not the "ANSI") version of the PostgreSQL ODBC driver. """ +import sys import uuid import unittest from decimal import Decimal @@ -702,7 +703,10 @@ def main(): s = unittest.TestSuite([ PGTestCase(connection_string, options.ansi, m) for m in methods ]) testRunner = unittest.TextTestRunner(verbosity=options.verbose) - testRunner.run(s) + result = testRunner.run(s) + + return result + if __name__ == '__main__': @@ -711,4 +715,4 @@ def main(): add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests3/sqldwtests.py b/tests3/sqldwtests.py index 238a2ff0..ae2438dd 100644 --- a/tests3/sqldwtests.py +++ b/tests3/sqldwtests.py @@ -1427,6 +1427,8 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(suite) + return result + if __name__ == '__main__': @@ -1435,4 +1437,4 @@ def main(): add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests3/sqlitetests.py b/tests3/sqlitetests.py index c9487348..65f5bbbb 100644 --- a/tests3/sqlitetests.py +++ b/tests3/sqlitetests.py @@ -679,7 +679,7 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(suite) - sys.exit(result.errors and 1 or 0) + return result if __name__ == '__main__': @@ -689,4 +689,4 @@ def main(): add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1) diff --git a/tests3/sqlservertests.py b/tests3/sqlservertests.py index d6e58e09..7ce4c43a 100644 --- a/tests3/sqlservertests.py +++ b/tests3/sqlservertests.py @@ -1821,6 +1821,8 @@ def main(): testRunner = unittest.TextTestRunner(verbosity=options.verbose) result = testRunner.run(suite) + return result + if __name__ == '__main__': @@ -1829,4 +1831,4 @@ def main(): add_to_path() import pyodbc - main() + sys.exit(0 if main().wasSuccessful() else 1)