'Running a raw query which can\'t obtain a FOR UPDATE lock raises
the correct exception'

@skipUnlessDBFeature('has_select_for_update')
def test_raw_lock_not_available(self):

    self.start_blocking_transaction()
    def raw(status):
        try:
            list(Person.objects.raw(('SELECT    *    FROM    %s    %s' % (Person._meta.db_table, connection.ops.for_update_sql(nowait=True)))))
        except DatabaseError as e:
            status.append(e)
        finally:
            connection.close()
    status = []
    thread = threading.Thread(target=raw, kwargs={'status': status})
    thread.start()
    time.sleep(1)
    thread.join()
    self.end_blocking_transaction()
    self.assertIsInstance(status[(-1)], DatabaseError)
