From 4f8c918ad401adea45b0e295d56652143a270d84 Mon Sep 17 00:00:00 2001 From: Benson Margulies Date: Thu, 30 Apr 2015 19:36:56 -0400 Subject: [PATCH] Fix issue #162 by making 'make tests' pass. --- Makefile | 24 ++++++++++++++++-------- tests/test_proxy.py | 12 ++++++++++-- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index e815409..ada7e90 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,26 @@ .PHONY: build_ext tests +JAVAC_OPTS=-target 1.6 -source 1.6 +JAVAC=javac $(JAVAC_OPTS) + build_ext: - javac jnius/src/org/jnius/NativeInvocationHandler.java + $(JAVAC) jnius/src/org/jnius/NativeInvocationHandler.java python setup.py build_ext --inplace -f -g +clean: + find . -name "*.class" -exec rm {} \; + rm -rf build + html: $(MAKE) -C docs html tests: build_ext - cd tests && javac org/jnius/HelloWorld.java - cd tests && javac org/jnius/BasicsTest.java - cd tests && javac org/jnius/MultipleMethods.java - cd tests && javac org/jnius/SimpleEnum.java - cd tests && javac org/jnius/InterfaceWithPublicEnum.java - cd tests && javac org/jnius/ClassArgument.java - cd tests && javac org/jnius/MultipleDimensions.java + cd tests && $(JAVAC) org/jnius/HelloWorld.java + cd tests && $(JAVAC) org/jnius/BasicsTest.java + cd tests && $(JAVAC) org/jnius/MultipleMethods.java + cd tests && $(JAVAC) org/jnius/SimpleEnum.java + cd tests && $(JAVAC) org/jnius/InterfaceWithPublicEnum.java + cd tests && $(JAVAC) org/jnius/ClassArgument.java + cd tests && $(JAVAC) org/jnius/MultipleDimensions.java + cp jnius/src/org/jnius/NativeInvocationHandler.class tests/org/jnius cd tests && env PYTHONPATH=..:$(PYTHONPATH) nosetests-2.7 -v diff --git a/tests/test_proxy.py b/tests/test_proxy.py index 7a5d7be..c7630ce 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -1,4 +1,5 @@ from jnius import autoclass, java_method, PythonJavaClass, cast +from nose.tools import * print '1: declare a TestImplem that implement Collection' @@ -104,7 +105,7 @@ class TestBadSignature(PythonJavaClass): pass -print '2: instanciate the class, with some data' +print '2: instantiate the class, with some data' a = TestImplem(*range(10)) print a print dir(a) @@ -150,4 +151,11 @@ print Collections.max(a2) #print Collections.shuffle(a2) # test bad signature -TestBadSignature() +threw = False +try: + TestBadSignature() +except Exception: + threw = True + +if not threw: + raise Exception("Failed to throw for bad signature")