From 2b4c7dff582722db0c32fab5dfaba4c8eade6218 Mon Sep 17 00:00:00 2001 From: Tony Roberts Date: Thu, 27 Feb 2014 10:23:56 +0000 Subject: [PATCH 1/4] runtests.py should return the error code from nosetests so travis knows it's failed --- pythonnet/src/tests/runtests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pythonnet/src/tests/runtests.py b/pythonnet/src/tests/runtests.py index 3ce023fca..c9de99b2e 100755 --- a/pythonnet/src/tests/runtests.py +++ b/pythonnet/src/tests/runtests.py @@ -62,10 +62,12 @@ def main(verbosity=1): module = __import__(name) suite.addTests((module.test_suite(),)) - unittest.TextTestRunner(verbosity=verbosity).run(suite) + return unittest.TextTestRunner(verbosity=verbosity).run(suite) if __name__ == '__main__': - main(1) + result = main(1) if '--pause' in sys.argv: print "Press enter to continue" raw_input() + sys.exit(result) + From bc932a3a03ce9716d5d142cbadd1c3b386c28d0f Mon Sep 17 00:00:00 2001 From: Tony Roberts Date: Thu, 27 Feb 2014 11:01:08 +0000 Subject: [PATCH 2/4] fix setupmono.py to work with python 2.6 and add to travis --- .travis.yml | 1 + pythonnet/setupmono.py | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index a9d5ace13..63d673adf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: python python: + - 2.6 - 2.7 before_install: - sudo apt-get install software-properties-common diff --git a/pythonnet/setupmono.py b/pythonnet/setupmono.py index bf13fb5a9..7a0b02901 100644 --- a/pythonnet/setupmono.py +++ b/pythonnet/setupmono.py @@ -6,7 +6,7 @@ from distutils.command.build_ext import build_ext from distutils.sysconfig import get_config_vars from platform import architecture -from subprocess import check_output, check_call +from subprocess import Popen, CalledProcessError, PIPE, check_call import shutil import sys import os @@ -77,10 +77,10 @@ def build_extension(self, ext): def _build_monoclr(self, ext): - mono_libs = check_output("pkg-config --libs mono-2", shell=True) - mono_cflags = check_output("pkg-config --cflags mono-2", shell=True) - glib_libs = check_output("pkg-config --libs glib-2.0", shell=True) - glib_cflags = check_output("pkg-config --cflags glib-2.0", shell=True) + mono_libs = _check_output("pkg-config --libs mono-2", shell=True) + mono_cflags = _check_output("pkg-config --cflags mono-2", shell=True) + glib_libs = _check_output("pkg-config --libs glib-2.0", shell=True) + glib_cflags = _check_output("pkg-config --cflags glib-2.0", shell=True) cflags = mono_cflags.strip() + " " + glib_cflags.strip() libs = mono_libs.strip() + " " + glib_libs.strip() @@ -129,6 +129,22 @@ def _build_monoclr(self, ext): debug=self.debug) +def _check_output(*popenargs, **kwargs): + """subprocess.check_output from python 2.7. + Added here to support building for earlier versions + of Python. + """ + process = Popen(stdout=PIPE, *popenargs, **kwargs) + output, unused_err = process.communicate() + retcode = process.poll() + if retcode: + cmd = kwargs.get("args") + if cmd is None: + cmd = popenargs[0] + raise CalledProcessError(retcode, cmd, output=output) + return output + + if __name__ == "__main__": setup(name="pythonnet", ext_modules=[ From 0acc47acdaaed22f5acbac490cc664716ecc0449 Mon Sep 17 00:00:00 2001 From: Tony Roberts Date: Thu, 27 Feb 2014 11:24:43 +0000 Subject: [PATCH 3/4] fix bug where converting a UInt32 doesn't raise an OverflowError --- pythonnet/src/runtime/converter.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pythonnet/src/runtime/converter.cs b/pythonnet/src/runtime/converter.cs index af7acd972..650a6178a 100644 --- a/pythonnet/src/runtime/converter.cs +++ b/pythonnet/src/runtime/converter.cs @@ -540,6 +540,14 @@ static bool ToPrimitive(IntPtr value, Type obType, out Object result, if (Exceptions.ErrorOccurred()) { goto overflow; } + + IntPtr check = Runtime.PyLong_FromUnsignedLong(ui); + int err = Runtime.PyObject_Compare(check, op); + Runtime.Decref(check); + if (0 != err || Exceptions.ErrorOccurred()) { + goto overflow; + } + result = ui; return true; From fd309f5e17da0d89835fd4cdf40261876d52bead Mon Sep 17 00:00:00 2001 From: Tony Roberts Date: Thu, 27 Feb 2014 11:36:08 +0000 Subject: [PATCH 4/4] raise an exception if any tests fail instead of returning the result --- pythonnet/src/tests/runtests.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pythonnet/src/tests/runtests.py b/pythonnet/src/tests/runtests.py index c9de99b2e..452b701f8 100755 --- a/pythonnet/src/tests/runtests.py +++ b/pythonnet/src/tests/runtests.py @@ -62,12 +62,13 @@ def main(verbosity=1): module = __import__(name) suite.addTests((module.test_suite(),)) - return unittest.TextTestRunner(verbosity=verbosity).run(suite) + result = unittest.TextTestRunner(verbosity=verbosity).run(suite) + if not result.wasSuccessful(): + raise Exception("Tests failed") if __name__ == '__main__': - result = main(1) + main(1) if '--pause' in sys.argv: print "Press enter to continue" raw_input() - sys.exit(result) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy