Skip to content

Commit

Permalink
Revert "enable the java-to-python tests"
Browse files Browse the repository at this point in the history
This reverts commit 5de1fe2.
  • Loading branch information
jmao-denver committed Dec 5, 2024
1 parent 5de1fe2 commit 4f7b61c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
8 changes: 3 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,7 @@ def test_python_java_classes():

def test_maven():
jpy_config = os.path.join(_build_dir(), 'jpyconfig.properties')
mvn_args = ('-DargLine=-Xmx512m -Djpy.config=' + jpy_config + ' -Djpy.debug=true' +
# disable the PyObject cleanup thread because the asynchronous nature of it makes
# stopPython/startPython flakey.
' -DPyObject.cleanup_on_thread=false')
mvn_args = '-DargLine=-Xmx512m -Djpy.config=' + jpy_config + ' -Djpy.debug=true'
log.info("Executing Maven goal 'test' with arg line " + repr(mvn_args))
code = subprocess.call(['mvn', 'test', mvn_args], shell=platform.system() == 'Windows')
return code == 0
Expand Down Expand Up @@ -285,7 +282,8 @@ def test_java(self):

suite.addTest(test_python_with_java_runtime)
suite.addTest(test_python_with_java_classes)
suite.addTest(test_java)
# comment out because the asynchronous nature of the PyObject GC in Java makes stopPython/startPython flakey.
# suite.addTest(test_java)

return suite

Expand Down
11 changes: 5 additions & 6 deletions src/test/java/org/jpy/PyObjectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,16 @@ public void testCall() throws Exception {
public void testGetSetAttributes() throws Exception {
// Python equivalent:
//
// >>> import impportlib.util
// >>> mod_spec = importlib.util.spec_from_loader('myobj', loader=None)
// >>> myobj = importlib.util.module_from_spec(mod_spec)
// >>> import imp
// >>> myobj = imp.new_module('myobj')
// >>> myobj.a = 'Tut tut!'
// >>> myobj.a
// 'Tut tut!'
//
try (
final PyModule imp = PyModule.importModule("importlib.util");
final PyObject moduleSpec = imp.call("spec_from_loader", "myobj", null);
final PyObject myobj = imp.call("module_from_spec", moduleSpec)) {
final PyModule imp = PyModule.importModule("imp");
final PyObject myobj = imp.call("new_module", "myobj")) {
// Call imp.new_module('') module
myobj.setAttribute("a", "Tut tut!");
Assert.assertEquals("Tut tut!", myobj.getAttribute("a", String.class));
try (final PyObject a = myobj.getAttribute("a")) {
Expand Down

0 comments on commit 4f7b61c

Please sign in to comment.