{{{#!python
self.assertFalse(conn.is_usable())
}}}
But SQLite's `is_usable()` has a hard-coded return value of `True`:
https://github.com/django/django/blob/3fa1ed53be370f4b1a94d78b56ff30d23b131623/django/db/backends/sqlite3/base.py#L387-L388
I guess this means that Django's CI doesn't check non-in-memory SQLite. If
it's true that Django doesn't check this case, I'm not sure if that means
it doesn't need to be fixed.
--
Ticket URL: <https://code.djangoproject.com/ticket/32445>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
> I guess this means that Django's CI doesn't check non-in-memory SQLite.
That's True, but I think it's still worth fixing. There is an interesting
[https://github.com/django/django/pull/7096#discussion_r74955788
discussion] about this test in the original PR. I think we should remove
`test_closes_connections()` from `django_test_skips()` and use
`@skipUnlessDBFeature('test_db_allows_multiple_connections')` instead.
--
Ticket URL: <https://code.djangoproject.com/ticket/32445#comment:1>
Comment (by Chris Jerdonek):
Just to be totally clear, would
`@skipUnlessDBFeature('test_db_allows_multiple_connections')` mean that
the test is or isn't skipped with non-in-memory SQLite?
--
Ticket URL: <https://code.djangoproject.com/ticket/32445#comment:2>
Comment (by Mariusz Felisiak):
Replying to [comment:2 Chris Jerdonek]:
> Just to be totally clear, would
`@skipUnlessDBFeature('test_db_allows_multiple_connections')` mean that
the test is or isn't skipped with non-in-memory SQLite?
It will always be skipped on SQLite, so also with non-in-memory database.
--
Ticket URL: <https://code.djangoproject.com/ticket/32445#comment:3>
Comment (by Chris Jerdonek):
> It will always be skipped on SQLite, so also with non-in-memory
database.
Okay, that's what I thought. Why do you think the test should always be
skipped on SQLite as opposed to making the test work also for non-in-
memory SQLite? It seems like making it work would be the better outcome
since it would cover more scenarios where the test makes sense.
--
Ticket URL: <https://code.djangoproject.com/ticket/32445#comment:4>
Comment (by Mariusz Felisiak):
Replying to [comment:4 Chris Jerdonek]:
> Okay, that's what I thought. Why do you think the test should always be
skipped on SQLite as opposed to making the test work also for non-in-
memory SQLite? It seems like making it work would be the better outcome
since it would cover more scenarios where the test makes sense.
Agreed, making the test work would be better, but I'm sure how to do this.
I would be happy to review a patch, if you have an idea.
--
Ticket URL: <https://code.djangoproject.com/ticket/32445#comment:5>
Comment (by Chris Jerdonek):
Agreed, thank you. I have some ideas, but not 100% sure it will work out.
--
Ticket URL: <https://code.djangoproject.com/ticket/32445#comment:6>
Comment (by Chris Jerdonek):
Okay, I came up with a solution for getting the test to work with non-in-
memory SQLite. The main idea is to use `TransactionTestCase` instead of
`TestCase`.
--
Ticket URL: <https://code.djangoproject.com/ticket/32445#comment:7>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/32445#comment:8>
* owner: nobody => Chris Jerdonek
* status: new => assigned
* stage: Accepted => Ready for checkin
Comment:
[https://github.com/django/django/pull/14012 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/32445#comment:9>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"5c4c3e2d1f232df6de24741ca1df32442a01ebc3" 5c4c3e2d]:
{{{
#!CommitTicketReference repository=""
revision="5c4c3e2d1f232df6de24741ca1df32442a01ebc3"
Fixed #32445 -- Fixed LiveServerThreadTest.test_closes_connections() for
non-in-memory database on SQLite.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32445#comment:10>