Not counting savepoint-related statements in assertNumQueries — there's some merit in this idea, as it would minimize test breakage in the 1.6 release, but it goes against the principle of least surprise.

Executing a comment eg. query.execute("-- RELEASE SAVEPOINT ...") under Oracle to keep the query counts identical on all backends,

Adding an implements_release_savepoint feature, and make the expected query count depend on that feature,

Simply make it depend on connection.vendor == 'oracle'.

Thoughts?

I'm attaching a patch implementing the last solution, because I'm lazy.

Last one means every assertNumQueries() where a nested transaction is involved (which is almost all of them) now needs to test for vendor==oracle. I think the best solution, if possible, is to increment the query count on the Oracle backend without executing anything.

The above notwithstanding, the patch has a with self.assertNumQueries(9): in line 3615 that should be with self.assertNumQueries(expected_queries):

Hmmh, yes, adding a dummy query to connection.queries without executing it seems like an excellent solution to me. The query could be something like "-- dummy RELEASE SAVEPOINT [not executed]". Maybe we should even add a connection._fake_execute() for this purpose so that Oracle doesn't need to know anything about connection.queries implementation?