diff --git a/django/test/utils.py b/django/test/utils.py index b1c528873c..41de932964 100644 --- a/django/test/utils.py +++ b/django/test/utils.py @@ -74,7 +74,10 @@ def teardown_test_environment(): def _set_autocommit(connection): "Make sure a connection is in autocommit mode." if hasattr(connection.connection, "autocommit"): - connection.connection.autocommit(True) + if callable(connection.connection.autocommit): + connection.connection.autocommit(True) + else: + connection.connection.autocommit = True elif hasattr(connection.connection, "set_isolation_level"): connection.connection.set_isolation_level(0)