我正在编写一个包含以下内容的简单集成测试:
I know #2 works and I have no problem with this.
但是,#1仅适用于前几个浏览器,然后挂起,导致随后的浏览器测试失败。我真的不明白为什么。
在我的代码中,这是我正在做的事情:
class Test:
def setup_class(cls):
ready_signal = threading.Event()
cls.port = 9000
cls.docroot = /tmp
cls.http_wrapper = SimpleHTTPWrap(port=cls.port, docroot=cls.docroot, ready_signal)
background_thread = threading.Thread(target=http_wrapper.start)
background_thread.daemon = True
background_thread.start()
ready_signal.wait(10) # Wait for thread to be ready (or proceed after timeout)
def test(self):
ip = get_my_ip_address()
self.browser = webdriver.Remote(_some_parameters_go_here)
self.browser.get('http://' + ip + ":" + cls.port + cls.docroot + '/test.html')
# This hangs after similar tests have already …Run Code Online (Sandbox Code Playgroud)