Testing

SnapConnectFuturesAutoTestCase

If your tests are failing with timeout errors, it may be because AsyncTestCase isn’t running the IOLoop that SnapConnectFuturesAuto is expecting. Use SnapConnectFuturesAutoTestCase as your base class for tests instead of AsyncTestCase to correct this problem.

class SnapConnectFuturesAutoTestCase(*args, **kwargs)

tornado.testing.AsyncTestCase with the correct override for get_new_ioloop to allow SnapConnectFuturesAuto to be used in test cases.

Example

from snapconnect_futures.testing import SnapConnectFuturesAutoTestCase
from tornado.testing import gen_test


class MyTestCase(SnapConnectFuturesAutoTestCase):

    @gen_test
    def test_that_uses_scfa(self):
        scf = SnapConnectFuturesAuto()
        yield scf.open_serial(1, 0)
        result = yield scf.callback_rpc("0DECAF", "getChannel")
        self.assertEqual(4, result)