two tests fail without network access
Closed this issue · 1 comments
rathann commented
Two of the tests require network access and while one is indeed testing network access, the other would also work with local files. Could you include the pdb files that test_round_trip_list
is trying to fetch in mmtf/tests/testdatastore
and switch to testing against local copies?
With the above change, I'd run the testsuite using:
nosetests -e test_fetch
or even with
python2 setup.py nosetests --no-network
if you added such option.
My use case is building mmtf-python as a package for Fedora and Fedora build system doesn't provide network access during build process for security and reproducibility.
Here's the log:
$ python2 setup.py nosetests
['mmtf', 'mmtf.codecs', 'mmtf.utils', 'mmtf.api', 'mmtf.converters', 'mmtf.tests', 'mmtf.codecs.encoders', 'mmtf.codecs.decoders']
running nosetests
running egg_info
writing requirements to mmtf_python.egg-info/requires.txt
writing mmtf_python.egg-info/PKG-INFO
writing top-level names to mmtf_python.egg-info/top_level.txt
writing dependency_links to mmtf_python.egg-info/dependency_links.txt
writing entry points to mmtf_python.egg-info/entry_points.txt
reading manifest file 'mmtf_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'mmtf_python.egg-info/SOURCES.txt'
..............E......E........
======================================================================
ERROR: test_fetch (mmtf.tests.codec_tests.ConverterTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builddir/build/BUILD/mmtf-python-1.0.5/mmtf/tests/codec_tests.py", line 194, in test_fetch
decoded = fetch("4CUP")
File "/builddir/build/BUILD/mmtf-python-1.0.5/mmtf/api/default_api.py", line 69, in fetch
decoder.decode_data(get_raw_data_from_url(pdb_id))
File "/builddir/build/BUILD/mmtf-python-1.0.5/mmtf/api/default_api.py", line 44, in get_raw_data_from_url
response = urllib2.urlopen(request)
File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python2.7/urllib2.py", line 429, in open
response = self._open(req, data)
File "/usr/lib64/python2.7/urllib2.py", line 447, in _open
'_open', req)
File "/usr/lib64/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 1230, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib64/python2.7/urllib2.py", line 1200, in do_open
raise URLError(err)
URLError: <urlopen error [Errno -2] Name or service not known>
======================================================================
ERROR: test_round_trip_list (mmtf.tests.codec_tests.ConverterTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builddir/build/BUILD/mmtf-python-1.0.5/mmtf/tests/codec_tests.py", line 355, in test_round_trip_list
self.round_trip(pdb_id)
File "/builddir/build/BUILD/mmtf-python-1.0.5/mmtf/tests/codec_tests.py", line 300, in round_trip
data_in = fetch(pdb_id)
File "/builddir/build/BUILD/mmtf-python-1.0.5/mmtf/api/default_api.py", line 69, in fetch
decoder.decode_data(get_raw_data_from_url(pdb_id))
File "/builddir/build/BUILD/mmtf-python-1.0.5/mmtf/api/default_api.py", line 44, in get_raw_data_from_url
response = urllib2.urlopen(request)
File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python2.7/urllib2.py", line 429, in open
response = self._open(req, data)
File "/usr/lib64/python2.7/urllib2.py", line 447, in _open
'_open', req)
File "/usr/lib64/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 1230, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib64/python2.7/urllib2.py", line 1200, in do_open
raise URLError(err)
URLError: <urlopen error [Errno -2] Name or service not known>
----------------------------------------------------------------------
Ran 30 tests in 0.118s
FAILED (errors=2)