Issue2310

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

Created on 2015-04-06.19:13:37 by jeff.allen, last changed 2015-05-04.21:33:19 by jeff.allen.

Messages
msg9768 (view) Author: Jeff Allen (jeff.allen) Date: 2015-04-06.19:13:37
Observed in 2.7rc2 on Windows 7 64-bit.

> jython -m test.test_import
Traceback (most recent call last):
  File "C:\jython\2.7rc2\Lib\runpy.py", line 161, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\jython\2.7rc2\Lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\jython\2.7rc2\Lib\test\test_import.py", line 606, in <module>
    class TestSymbolicallyLinkedPackage(unittest.TestCase):
  File "C:\jython\2.7rc2\Lib\test\test_import.py", line 635, in TestSymbolicallyLinkedPackage
    @unittest.skipUnless(
  File "C:\jython\2.7rc2\Lib\test\symlink_support.py", line 25, in skip_unless_symlink
    ok = can_symlink()
  File "C:\jython\2.7rc2\Lib\test\symlink_support.py", line 14, in can_symlink
    symlink(TESTFN, symlink_path)
  File "C:\jython\2.7rc2\Lib\test\symlink_support.py", line 14, in can_symlink
    symlink(TESTFN, symlink_path)
TypeError: 'NoneType' object is not callable

It looks like this test never got started. I wonder at the ref to symlinks on Windows. Similar idea exists, but CPython os.symlink is available on Unix only. I suspect a use of os.name again. (Does setting that to 'java' really break less code than setting it to 'nt' etc.?)
msg9783 (view) Author: Jim Baker (zyasoft) Date: 2015-04-09.23:40:20
Unfortunately a bit late in the game for os.name vs os._name! ;)

So this capabilities testing is buggy, since symlink can be set to None in 

symlink = os.symlink if hasattr(os, 'symlink') else (
    _symlink_win32 if platform.system() == 'Windows' else None
)

which seems quite reasonable, but the can_symlink does not properly account for that possibility. I would suggest fixing the problem in the can_symlink function.
msg9907 (view) Author: Jeff Allen (jeff.allen) Date: 2015-04-20.16:42:32
I was working on something else, but I found that I'd fixed this.
msg9982 (view) Author: Jeff Allen (jeff.allen) Date: 2015-04-29.06:20:50
That's eager! I'll push this change at the same times as other import-related fixes.
msg10022 (view) Author: Jeff Allen (jeff.allen) Date: 2015-05-04.21:33:19
https://hg.python.org/jython/rev/85f7eda810b2
History
Date User Action Args
2015-05-04 21:33:19jeff.allensetmessages: + msg10022
2015-04-29 06:20:51jeff.allensetmessages: + msg9982
2015-04-29 01:55:23zyasoftsetstatus: open -> closed
2015-04-20 16:42:32jeff.allensetassignee: jeff.allen
resolution: fixed
messages: + msg9907
2015-04-09 23:40:20zyasoftsetnosy: + zyasoft
messages: + msg9783
2015-04-06 19:13:37jeff.allencreate