Issue2538

classification
Title: Test failures in test_unittest
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
Priority: normal Keywords: test failure causes

Created on 2016-12-09.23:20:38 by jeff.allen, last changed 2017-02-01.19:25:43 by jeff.allen.

Messages
msg11001 (view) Author: Jeff Allen (jeff.allen) Date: 2016-12-09.23:20:37
Odd that this should have started happening:

======================================================================
FAIL: test_loadTestsFromName__relative_empty_name (__main__.Test_TestLoader)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\hg\jython-int\dist\Lib\test\test_unittest.py", line 328, in test_loadTestsFromName__relative_empty_name
    self.fail("Failed to raise AttributeError")
AssertionError: Failed to raise AttributeError

======================================================================
FAIL: test_loadTestsFromNames__relative_empty_name (__main__.Test_TestLoader)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\hg\jython-int\dist\Lib\test\test_unittest.py", line 666, in test_loadTestsFromNames__relative_empty_name
    self.fail("Failed to raise ValueError")
AssertionError: Failed to raise ValueError

----------------------------------------------------------------------

The cause appears to be that the unittest module does indeed have an attribute called '':

>>> import unittest
>>> getattr(unittest, '')
<module 'unittest.' from 'D:\hg\jython-int\dist\Lib\unittest\__init__$py.class'>
>>>
msg11002 (view) Author: Jeff Allen (jeff.allen) Date: 2016-12-10.08:17:52
Aha!

>>> import json
>>> json.__dict__.keys()
['__path__', '__builtins__', 'scanner', '__author__', 'encoder', '__doc__', 'decoder', '__file__', ...
>>> hasattr(json, '')
True
>>> json.__dict__.keys()
['__path__', '__builtins__', 'scanner', '__author__', 'encoder', '__doc__', 'decoder', '', '__file__', ...
>>>

The nameless attribute seems to be self-inventing (but only for PyModule).
msg11003 (view) Author: Jeff Allen (jeff.allen) Date: 2016-12-11.08:29:37
I claim fixed in #75bad1f35a71
History
Date User Action Args
2017-02-01 19:25:43jeff.allensetstatus: pending -> closed
2016-12-11 08:29:37jeff.allensetstatus: open -> pending
resolution: fixed
messages: + msg11003
2016-12-10 08:17:52jeff.allensetmessages: + msg11002
2016-12-09 23:20:38jeff.allencreate