'Test fetching, deleting and finally saving an object - we should get
an insert in this case.'

@skipUnlessDBFeature('test_db_allows_multiple_connections')
def test_concurrent_delete_with_save(self):

    a = Article.objects.create(headline='foo', pub_date=datetime.now())
    exceptions = []
    def deleter():
        try:
            Article.objects.filter(pk=a.pk).delete()
        except Exception as e:
            exceptions.append(e)
        finally:
            connections[DEFAULT_DB_ALIAS].close()
    self.assertEqual(len(exceptions), 0)
    t = threading.Thread(target=deleter)
    t.start()
    t.join()
    a.save()
    self.assertEqual(Article.objects.get(pk=a.pk).headline, 'foo')
