Bug 1034712

Summary: [python27] test failure in python test_urllib
Product: Red Hat Software Collections Reporter: Bohuslav "Slavek" Kabrda <bkabrda>
Component: pythonAssignee: Matej Stuchlik <mstuchli>
Status: CLOSED NOTABUG QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: python27CC: jberan, mstuchli
Target Milestone: beta   
Target Release: 1.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-28 12:21:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.