I am using SUDS to access a SOAP server. When I run the script directly, I have no problems. If I use nosetest to run the script, the connection to the server fails:
Traceback (most recent call last):
File "c:\python25\lib\site-packages\nose-0.11.3-py2.5.egg\nose\suite.py", line 197, in run
self.setUp()
File "c:\python25\lib\site-packages\nose-0.11.3-py2.5.egg\nose\suite.py", line 280, in setUp
self.setupContext(ancestor)
File "c:\python25\lib\site-packages\nose-0.11.3-py2.5.egg\nose\suite.py", line 303, in setupContext
try_run(context, names)
File "c:\python25\lib\site-packages\nose-0.11.3-py2.5.egg\nose\util.py", line 491, in try_run
return func()
File "E:\server Test\workspace\Server tester\src\tests\__init__.py", line 6, in setup
connect.start()
File "E:\server Test\workspace\Server tester\src\tests\connect.py", line 7, in start
connection = Client("http://localhost:8888/ClearCore?WSDL")
File "E:\server Test\workspace\Suds experiment\src\suds\client.py", line 111, in __init__
self.wsdl = reader.open(url)
File "E:\server Test\workspace\Suds experiment\src\suds\reader.py", line 136, in open
d = self.fn(url, self.options)
File "E:\server Test\workspace\Suds experiment\src\suds\wsdl.py", line 159, in __init__
self.build_schema()
File "E:\server Test\workspace\Suds experiment\src\suds\wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "E:\server Test\workspace\Suds experiment\src\suds\xsd\schema.py", line 92, in load
child.open_imports(options)
File "E:\server Test\workspace\Suds experiment\src\suds\xsd\schema.py", line 298, in open_imports
imported = imp.open(options)
File "E:\server Test\workspace\Suds experiment\src\suds\xsd\sxbasic.py", line 515, in open
result = self.download(options)
File "E:\server Test\workspace\Suds experiment\src\suds\xsd\sxbasic.py", line 533, in download
d = reader.open(url)
File "E:\server Test\workspace\Suds experiment\src\suds\reader.py", line 73, in open
d = self.download(url)
File "E:\server Test\workspace\Suds experiment\src\suds\reader.py", line 88, in download
fp = self.options.transport.open(Request(url))
File "E:\server Test\workspace\Suds experiment\src\suds\transport\https.py", line 60, in open
return HttpTransport.open(self, request)
File "E:\server Test\workspace\Suds experiment\src\suds\transport\http.py", line 62, in open
return self.u2open(u2request)
File "E:\server Test\workspace\Suds experiment\src\suds\transport\http.py", line 116, in u2open
return url.open(u2request)
File "C:\Python25\lib\urllib2.py", line 381, in open
response = self._open(req, data)
File "C:\Python25\lib\urllib2.py", line 399, in _open
'_open', req)
File "C:\Python25\lib\urllib2.py", line 360, in _call_chain
result = func(*args)
File "C:\Python25\lib\urllib2.py", line 1107, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Python25\lib\urllib2.py", line 1082, in do_open
raise URLError(err)
URLError: urlopen error timed out
-------------------- begin captured logging --------------------
suds.wsdl: DEBUG: reading wsdl at: http://localhost:8888/ClearCore?WSDL ...
suds.transport.http: DEBUG: opening (http://localhost:8888/ClearCore?WSDL)
suds.metrics: DEBUG: sax (addinfourl at 23891040 whose fp = (socket._fileobject object at 0x016B4830> )) duration: 950 (ms)
suds.xsd.sxbasic: DEBUG: Import:0x1c10b50, importing ns="http://tempuri.org/", location="http://localhost:8888/ClearCore?xsd=xsd0"
suds.transport.http: DEBUG: opening (http://localhost:8888/ClearCore?xsd=xsd0)
--------------------- end captured logging ---------------------
The script itself is pretty simple:
main.py:
import nose
import tests.connect
if False:
tests.connect.start()
print tests.connect.connection
tests.connect.stop()
else:
nose.main()
tests/__init__.py:
from suds.client import Client
import connect
def setup():
connect.start()
def teardown():
connect.stop()
tests/connect.py:
from suds.client import Client
connection = None
def start():
global connection
connection = Client("http://localhost:8888/ClearCore?WSDL")
def stop():
global connection
connection = None
tests/test_1.py:
def fred_test():
print "fred_test"
assert 1==1, "hello"
Why am I getting this error, and how do I get things to work?