Fix issue #162 by making 'make tests' pass.

This commit is contained in:
Benson Margulies 2015-04-30 19:36:56 -04:00
parent cca4da3cb0
commit 4f8c918ad4
2 changed files with 26 additions and 10 deletions

View File

@ -1,18 +1,26 @@
.PHONY: build_ext tests .PHONY: build_ext tests
JAVAC_OPTS=-target 1.6 -source 1.6
JAVAC=javac $(JAVAC_OPTS)
build_ext: build_ext:
javac jnius/src/org/jnius/NativeInvocationHandler.java $(JAVAC) jnius/src/org/jnius/NativeInvocationHandler.java
python setup.py build_ext --inplace -f -g python setup.py build_ext --inplace -f -g
clean:
find . -name "*.class" -exec rm {} \;
rm -rf build
html: html:
$(MAKE) -C docs html $(MAKE) -C docs html
tests: build_ext tests: build_ext
cd tests && javac org/jnius/HelloWorld.java cd tests && $(JAVAC) org/jnius/HelloWorld.java
cd tests && javac org/jnius/BasicsTest.java cd tests && $(JAVAC) org/jnius/BasicsTest.java
cd tests && javac org/jnius/MultipleMethods.java cd tests && $(JAVAC) org/jnius/MultipleMethods.java
cd tests && javac org/jnius/SimpleEnum.java cd tests && $(JAVAC) org/jnius/SimpleEnum.java
cd tests && javac org/jnius/InterfaceWithPublicEnum.java cd tests && $(JAVAC) org/jnius/InterfaceWithPublicEnum.java
cd tests && javac org/jnius/ClassArgument.java cd tests && $(JAVAC) org/jnius/ClassArgument.java
cd tests && javac org/jnius/MultipleDimensions.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 cd tests && env PYTHONPATH=..:$(PYTHONPATH) nosetests-2.7 -v

View File

@ -1,4 +1,5 @@
from jnius import autoclass, java_method, PythonJavaClass, cast from jnius import autoclass, java_method, PythonJavaClass, cast
from nose.tools import *
print '1: declare a TestImplem that implement Collection' print '1: declare a TestImplem that implement Collection'
@ -104,7 +105,7 @@ class TestBadSignature(PythonJavaClass):
pass pass
print '2: instanciate the class, with some data' print '2: instantiate the class, with some data'
a = TestImplem(*range(10)) a = TestImplem(*range(10))
print a print a
print dir(a) print dir(a)
@ -150,4 +151,11 @@ print Collections.max(a2)
#print Collections.shuffle(a2) #print Collections.shuffle(a2)
# test bad signature # test bad signature
threw = False
try:
TestBadSignature() TestBadSignature()
except Exception:
threw = True
if not threw:
raise Exception("Failed to throw for bad signature")