Issue2313

classification
Title: test_jython_initializer failure on Windows
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7
Milestone:
process
Status: pending Resolution: fixed
Dependencies: Superseder:
Assigned To: jeff.allen Nosy List: jamesmudd, jeff.allen
Priority: Keywords: test failure causes

Created on 2015-04-06.19:58:06 by jeff.allen, last changed 2017-04-30.21:31:52 by jeff.allen.

Messages
msg9771 (view) Author: Jeff Allen (jeff.allen) Date: 2015-04-06.19:58:05
Observed in Jython 2.7rc2 on Windows 7:

> jython -m test.test_jython_initializer
test_syspath_initializer (__main__.TestUsingInitializer) ... Traceback (most recent call last):
  File "C:\jython\2.7rc2\Lib\test\check_for_initializer_in_syspath.py", line 4, in <module>
    assert path in sys.path
AssertionError
FAIL

======================================================================
FAIL: test_syspath_initializer (__main__.TestUsingInitializer)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\jython\2.7rc2\Lib\test\test_jython_initializer.py", line 22, in test_syspath_initializer
    self.assertEquals(0, subprocess.call([sys.executable, fn], env=env))
AssertionError: 0 != -1

----------------------------------------------------------------------
Ran 1 test in 5.959s

I wonder if the path is not passed on correctly whether this might be behind several other problems with import.
msg11213 (view) Author: James Mudd (jamesmudd) Date: 2017-03-09.21:18:32
This test fails for me on Linux as well when run individually:

james@james-ubuntu:~/git/jython/dist$ bin/jython Lib/test/test_jython_initializer.py 
test_syspath_initializer (__main__.TestUsingInitializer) ... Traceback (most recent call last):
  File "/home/james/git/jython/dist/Lib/test/check_for_initializer_in_syspath.py", line 4, in <module>
    assert path in sys.path
AssertionError
FAIL

======================================================================
FAIL: test_syspath_initializer (__main__.TestUsingInitializer)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_jython_initializer.py", line 22, in test_syspath_initializer
    self.assertEquals(0, subprocess.call([sys.executable, fn], env=env))
AssertionError: 0 != 255

----------------------------------------------------------------------
Ran 1 test in 1.970s

FAILED (failures=1)
Traceback (most recent call last):
  File "Lib/test/test_jython_initializer.py", line 28, in <module>
    test_main()
  File "Lib/test/test_jython_initializer.py", line 25, in test_main
    test_support.run_unittest(TestUsingInitializer)
  File "/home/james/git/jython/dist/Lib/test/test_support.py", line 1320, in run_unittest
    _run_suite(suite)
  File "/home/james/git/jython/dist/Lib/test/test_support.py", line 1303, in _run_suite
    raise TestFailed(err)
test.test_support.TestFailed: Traceback (most recent call last):
  File "Lib/test/test_jython_initializer.py", line 22, in test_syspath_initializer
    self.assertEquals(0, subprocess.call([sys.executable, fn], env=env))
AssertionError: 0 != 255

james@james-ubuntu:~/git/jython/dist$
msg11295 (view) Author: James Mudd (jamesmudd) Date: 2017-04-04.21:47:19
I have a pull request to fix this one https://github.com/jythontools/jython/pull/70

It fails on Windows because the path to a class file outside /dist was hardcoded. To remove this, I decided the nicest approach was to create a jar which includes the .java and .class files and also the service definition, which can be picked up to initialise Jython, at startup.

This approach also allows a custom compile directory to be removed from the build script.

I have tested on Linux and Windows with Java 7 and 8 but if anyone else wants to give it a try guess that would be good.
msg11333 (view) Author: Jeff Allen (jeff.allen) Date: 2017-04-30.21:31:51
Believed fixed at https://hg.python.org/jython/rev/0a00982f6ea5
History
Date User Action Args
2017-04-30 21:31:52jeff.allensetstatus: open -> pending
assignee: jeff.allen
resolution: fixed
messages: + msg11333
2017-04-04 21:47:20jamesmuddsetmessages: + msg11295
2017-03-09 21:18:33jamesmuddsetnosy: + jamesmudd
messages: + msg11213
2015-04-06 19:58:06jeff.allencreate