def test_raises_other_exception_on_write_attempt(self):
        class FakeException(Exception):
            pass

        self.context.inject(open,
                            func_that_raises(FakeException("intentional")))
        self.create_fake_archive()
        expect(BrowserStackTunnel).to(raise_ex(FakeException))
 def test_waits_up_to_configured_limit(self):
     self.webdriver.Remote = func_that_raises(AllBrowsersBusy())
     ctl = TimeController(target=Browser, parent_context=self.context)
     ctl.start()
     sleep(0.05)
     ctl.advance(seconds=self.timeout - 0.01)
     sleep(0.05)
     try:
         expect(ctl.exception_caught).to(equal(None))
     finally:
         ctl.advance(days=180)
         ctl.join()
 def test_re_raises_after_timeout(self):
     raised = AllBrowsersBusy()
     self.webdriver.Remote = func_that_raises(raised)
     ctl = TimeController(target=Browser, parent_context=self.context)
     ctl.start()
     sleep(0.05)
     ctl.advance(seconds=self.timeout + 0.01)
     sleep(0.05)
     try:
         expect(ctl.exception_caught).to(equal(raised))
     finally:
         ctl.advance(days=180)
         ctl.join()
 def test_does_not_wait_after_other_exception(self):
     self.webdriver.Remote = func_that_raises(FakeException())
     expect(Browser).to(complain(FakeException))
 def test_raises_other_os_error_on_write_attempt(self):
     e = OSError("intentional")
     e.errno = errno.ETXTBSY + 1
     self.context.inject(open, func_that_raises(e))
     self.create_fake_archive()
     expect(BrowserStackTunnel).to(raise_ex(OSError))
 def test_ignores_busy_file_on_write_attempt(self):
     e = OSError("intentional")
     e.errno = errno.ETXTBSY
     self.context.inject(open, func_that_raises(e))
     self.create_fake_archive()
     expect(BrowserStackTunnel).not_to(raise_ex(OSError))