質問

Seleniumを使ってブラウススタースタックに接続するためのDjango(バージョン1.3、悲しいことに)管理コマンドを書いていて、統合テストを実行するために使用しようとしています。(私はこのサイトの中にアスクボットを使う事実を回避するためにカスタム管理コマンドを書いていなければならず、それはいくつかの面白い方法でDjangoテストフレームワークをめぐる。それ以外の場合はテストフレームワークを使用するだけです。)

スクリプトの山数はここにあります https://gist.github.com/cellofellow/749122121(a)>。これは、Djangoコンテキストなしで直接UnitTを走っていた以前のスクリプトのポートです。

起こることは、RANのとき、私はそのようなトレースバックを受け取ることです。

./manage.py browserstack signup
Browser: IE
Browser Version: 10.0
Operating System: Windows
OS Version: 7

E
======================================================================
ERROR: runTest (apps.common.management.commands.browserstack.SignUpBasic)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jgardner/izeni/doterra_pro/apps/common/management/commands/browserstack.py", line 46, in setUp
    desired_capabilities=self.caps)
  File "/home/jgardner/.virtualenvs/doterra_pro/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/home/jgardner/.virtualenvs/doterra_pro/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
    'desiredCapabilities': desired_capabilities,
  File "/home/jgardner/.virtualenvs/doterra_pro/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 162, in execute
    response = self.command_executor.execute(driver_command, params)
  File "/home/jgardner/.virtualenvs/doterra_pro/local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 355, in execute
    return self._request(url, method=command_info[0], data=data)
  File "/home/jgardner/.virtualenvs/doterra_pro/local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 402, in _request
    response = opener.open(request)
  File "/usr/lib/python2.7/urllib2.py", line 410, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 442, in error
    result = self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 897, in http_error_401
    url, req, headers)
  File "/usr/lib/python2.7/urllib2.py", line 872, in http_error_auth_reqed
    response = self.retry_http_basic_auth(host, req, realm)
  File "/usr/lib/python2.7/urllib2.py", line 885, in retry_http_basic_auth
    return self.parent.open(req, timeout=req.timeout)
  File "/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1214, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1187, in do_open
    r = h.getresponse(buffering=True)
  File "/usr/lib/python2.7/httplib.py", line 1045, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 409, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 365, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "/usr/lib/python2.7/socket.py", line 476, in readline
    data = self._sock.recv(self._rbufsize)
timeout: timed out

----------------------------------------------------------------------
Ran 1 test in 5.201s

FAILED (errors=1)
.

ブラウズススタックのインスタンスは起動されますが、次に何が起こることもできませんので、単に1分以内に実行してから終了します。

それが移植されたスクリプトはこの問題を持っていませんでした。それを引き起こす可能性がありますか?

役に立ちましたか?

解決

は、socket.setdefaulttimeout(60)を設定しなければならなかったため、このコードベースのsocket.setdefaulttimeoutには、依存関係と独自のコードの両方で数十の呼び出しがあります。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top