Avoided transaction.set_autocommit in tests.

It doesn't work as one might expect on a certain database backend where
autocommits_when_autocommit_is_off = True. That backend happens to be
popular for running tests.
Fixed #20724 -- Test failure on SQLite.

This test failure happened if the connection's NAME was set to a file
system path, and its TEST_NAME wasn't.

Thanks Claude for the report.