Bug 1034712 - [python27] test failure in python test_urllib
Summary: [python27] test failure in python test_urllib
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Software Collections
Classification: Red Hat
Component: python
Version: python27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: beta
: 1.1
Assignee: Matej Stuchlik
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-26 11:38 UTC by Bohuslav "Slavek" Kabrda
Modified: 2016-02-01 02:15 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-28 12:21:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Bohuslav "Slavek" Kabrda 2013-11-26 11:38:24 UTC
Two tests in test_urllib fail. Output from the brew build log [1]:

test_urllib failed -- Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-2.7.5/Lib/test/test_urllib.py", line 235, in test_missing_localfile
    fp.close()
UnboundLocalError: local variable 'fp' referenced before assignment
ok
======================================================================
ERROR: test_missing_localfile (test.test_urllib.urlopen_HttpTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-2.7.5/Lib/test/test_urllib.py", line 235, in test_missing_localfile
    fp.close()
UnboundLocalError: local variable 'fp' referenced before assignment
----------------------------------------------------------------------

This certainly shouldn't block anything, but it'd be nice to find out why the test is failing and fix it.


[1] http://download.devel.redhat.com/brewroot/packages/python27-python/2.7.5/9.el6/data/logs/x86_64/build.log

Comment 2 Matej Stuchlik 2014-01-21 09:11:15 UTC
Python tracker issue #16450 [0] seems to be related, in which case commit [1] should fix this.

[0] http://bugs.python.org/issue16450
[1] http://hg.python.org/cpython/rev/60c195e89c88

Comment 3 Matej Stuchlik 2014-01-28 12:21:23 UTC
Applying the above patch reveals that the real problem is:

======================================================================
ERROR: test_missing_localfile (test.test_urllib.urlopen_HttpTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-2.7.5/Lib/test/test_urllib.py", line 233, in test_missing_localfile
    fp = urllib.urlopen(tmp_fileurl)
  File "/builddir/build/BUILD/Python-2.7.5/Lib/urllib.py", line 87, in urlopen
    return opener.open(url)
  File "/builddir/build/BUILD/Python-2.7.5/Lib/urllib.py", line 208, in open
    return getattr(self, name)(url)
  File "/builddir/build/BUILD/Python-2.7.5/Lib/urllib.py", line 463, in open_file
    return self.open_local_file(url)
  File "/builddir/build/BUILD/Python-2.7.5/Lib/urllib.py", line 494, in open_local_file
    and socket.gethostbyname(host) in (localhost(), thishost()):
  File "/builddir/build/BUILD/Python-2.7.5/Lib/urllib.py", line 822, in thishost
    _thishost = socket.gethostbyname(socket.gethostname())
IOError: [Errno socket error] [Errno -3] Temporary failure in name resolution
----------------------------------------------------------------------

which, looking at #221583, appears to be caused by a misconfiguration of DNS and has nothing to do with python.


Note You need to log in before you can comment on or make changes to this bug.