Hello, PyLucene User and Developers Problems occurred during `make test` in pylucene-6.2.0 from PyLucen Homepage <http://lucene.apache.org/pylucene> when testing 'test_PythonException.py'. And I think there might be something wrong with the test python code.
The test python code I run and the Error Log are posted at the end of this email. The test script raised a python-exception(TestException). But it return a JavaError first, which failed the test. If I change assertRaises(TestException) to assertRaises(lucene.JavaError) here, it passed the test. Should I make this change to pass the test. Or am I missing something? Thanks for your advice! Here comes the python script: import sys, lucene, unittest from PyLuceneTestCase import PyLuceneTestCase from org.apache.lucene.analysis.standard import StandardAnalyzer from org.apache.pylucene.queryparser.classic import PythonQueryParser class PythonExceptionTestCase(PyLuceneTestCase): def testThroughLayerException(self): class TestException(Exception): pass class TestQueryParser(PythonQueryParser): def getFieldQuery_quoted(_self, field, queryText, quoted): raise TestException("TestException") qp = TestQueryParser('all', StandardAnalyzer()) with self.assertRaises(TestException): qp.parse("foo bar") if __name__ == "__main__": lucene.initVM(vmargs=['-Djava.awt.headless=true']) if '-loop' in sys.argv: print "in if" sys.argv.remove('-loop') while True: try: unittest.main() except: pass else: print "in else" unittest.main() Here's the Error StackTrace: shawn@shawn-Precision-T1700:~/workspace/pylucene-6.2.0/test$ python ./test_PythonException.py in else E ====================================================================== ERROR: testThroughLayerException (__main__.PythonExceptionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "./test_PythonException.py", line 34, in testThroughLayerException qp.parse("foo bar") JavaError: <super: <class 'JavaError'>, <JavaError object>> Java stacktrace: java.lang.RuntimeException: TestException at org.apache.pylucene.queryparser.classic.PythonQueryParser.getFieldQuery_quoted(Native Method) at org.apache.pylucene.queryparser.classic.PythonQueryParser.getFieldQuery(Unknown Source) at org.apache.lucene.queryparser.classic.QueryParser.MultiTerm( QueryParser.java:585) at org.apache.lucene.queryparser.classic.QueryParser.Query( QueryParser.java:198) at org.apache.lucene.queryparser.classic.QueryParser. TopLevelQuery(QueryParser.java:187) at org.apache.lucene.queryparser.classic.QueryParserBase.parse( QueryParserBase.java:111)