मैं लाइव परीक्षण चलाने के लिए Django (1.5.5), सेलेनियम (2.41.0), स्प्लिंटर (0.6.0) और प्रेतोज़ (1.9.7) का उपयोग कर रहा हूं।Django LiveServerTestCase phantomjs intermittent hangs/timeouts
जबकि परीक्षण ज्यादातर काम करते हैं, हर बार और फिर (अक्सर सर्किलसीआई पर, अक्सर स्थानीय वीएम में अक्सर) वे तब तक लटकते हैं जब तक सर्कलसीआई पर टाइमआउट नहीं होता है या मैं मैन्युअल रूप से धावक को मारता हूं (Ctrl-C यानी कीबोर्ड इंटरप्ट काम करता है)।
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 86, in run
self.finish_response()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 127, in finish_response
self.write(data)
File "/usr/lib/python2.7/wsgiref/handlers.py", line 215, in write
self._write(data)
File "/usr/lib/python2.7/socket.py", line 324, in write
self.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 104] Connection reset by peer
Traceback (most recent call last):
File "/home/ubuntu/memo-angel/venv/local/lib/python2.7/site-packages/django/test/testcases.py", line 998, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/home/ubuntu/memo-angel/venv/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 150, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "/usr/lib/python2.7/SocketServer.py", line 640, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 693, in finish
self.wfile.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
ऐसा ही एक समस्या के रूप में Django with splinter and phantomjs is painfully slow में चर्चा किया गया है हो सकता है:
class SplinterTestCase(LiveServerTestCase):
@classmethod
def setUpClass(cls):
super(SplinterTestCase, cls).setUpClass()
# start phantom just once per class, to speed up tests
cls.phantom = splinter.Browser('phantomjs', load_images=False)
@classmethod
def tearDownClass(cls):
cls.phantom.quit()
super(SplinterTestCase, cls).tearDownClass()
def login(self, *args, **kwargs):
# perform a login using Django builtin "client", steal the session
# cookie and inject it to phantomjs, avoiding the need to do the
# login dance for each test
from django.conf import settings
cn = settings.SESSION_COOKIE_NAME
self.django_client.login(*args, **kwargs)
if cn in self.django_client.cookies:
self.client.driver.add_cookie({
'name': cn,
'value': self.django_client.cookies[cn].value,
'path': '/',
'domain': 'localhost'
})
def setUp(self):
# use phantom as the test client instead of Django's
super(SplinterTestCase, self).setUp()
self.django_client = self.client
self.client = self.phantom
def tearDown(self):
# this seems to help somewhat (decreases the number of timeouts), but
# doesn't solve it completely
self.client.visit('about:config')
super(SplinterTestCase, self).tearDown()
Ctrl-C के बाद, इस स्टैकट्रेस मैं मिलता है:
यह कैसे मेरे आधार परीक्षण वर्ग लग रहा है मूल पोस्टर ने यह भी उल्लेख किया "यह तब तक स्थिर हो जाता है जब तक कि मैं इसे पूरा करने के लिए प्रतीक्षा करने के लिए धैर्य से बाहर नहीं हूं"। वहां दिए गए उत्तर में फैंटोमज क्लास सेटअप/टियरडाउन में शुरू/बंद करने की कोशिश करने के लिए उल्लेख किया गया है, जो मैंने यहां किया था, लेकिन यह समस्या का समाधान नहीं करता है।
क्या किसी ने भी इसी तरह की समस्या का अनुभव किया है, और यदि आपके पास है, तो आपके कामकाज क्या हैं?
मैं उन सभी घटकों के नवीनतम संस्करण के साथ एक समान समस्या है (के रूप में जनवरी 2017 का)। मेरा सबसे अच्छा कामकाज मैकेटोरस उत्तर और इसके बारे में मेरी टिप्पणी है। –