def setup_mock_database(self):
        self._db_patch = patch('django.db.backends.util.CursorWrapper')
        db_mock = self._db_patch.start()
        error = RuntimeError(
            "Attempt to access database in a 'no database' test suite run. "
            "It could be that you don't have 'BASE_ADDRESS' set in your localsettings.py. "
            "If your test really needs database access it must subclass 'TestCase' and not 'SimpleTestCase'.")
        db_mock.side_effect = error

        mock_couch = Mock(side_effect=error, spec=[])

        # register our dbs with the extension document classes
        old_handler = loading.couchdbkit_handler
        for app, value in old_handler.app_schema.items():
            for name, cls in value.items():
                cls.set_db(mock_couch)

        couchlog.signals.got_request_exception.disconnect(
            couchlog.signals.log_request_exception)
Ensure that touching the DB raises and error.
dataset/ETHPy150Open dimagi/commcare-hq/testrunner.py/TwoStageTestRunner.setup_mock_database