mirror of https://github.com/python/cpython.git
bpo-24464: Fix sqlite3.enable_shared_cache() deprecation wrapper (GH-24170)
This commit is contained in:
parent
0e2a0f72cc
commit
d16f6176ab
|
@ -96,7 +96,7 @@ def enable_shared_cache(enable):
|
||||||
"the cache=shared query parameter."
|
"the cache=shared query parameter."
|
||||||
)
|
)
|
||||||
warnings.warn(msg, DeprecationWarning, stacklevel=2)
|
warnings.warn(msg, DeprecationWarning, stacklevel=2)
|
||||||
return _old_enable_shared_cache
|
return _old_enable_shared_cache(enable)
|
||||||
|
|
||||||
# Clean up namespace
|
# Clean up namespace
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
import threading
|
import threading
|
||||||
import unittest
|
import unittest
|
||||||
import sqlite3 as sqlite
|
import sqlite3 as sqlite
|
||||||
|
import sys
|
||||||
|
|
||||||
from test.support.os_helper import TESTFN, unlink
|
from test.support.os_helper import TESTFN, unlink
|
||||||
|
|
||||||
|
@ -82,6 +83,9 @@ def test_not_supported_error(self):
|
||||||
sqlite.DatabaseError),
|
sqlite.DatabaseError),
|
||||||
"NotSupportedError is not a subclass of DatabaseError")
|
"NotSupportedError is not a subclass of DatabaseError")
|
||||||
|
|
||||||
|
# sqlite3_enable_shared_cache() is deprecated on macOS and calling it may raise
|
||||||
|
# OperationalError on some buildbots.
|
||||||
|
@unittest.skipIf(sys.platform == "darwin", "shared cache is deprecated on macOS")
|
||||||
def test_shared_cache_deprecated(self):
|
def test_shared_cache_deprecated(self):
|
||||||
for enable in (True, False):
|
for enable in (True, False):
|
||||||
with self.assertWarns(DeprecationWarning) as cm:
|
with self.assertWarns(DeprecationWarning) as cm:
|
||||||
|
|
Loading…
Reference in New Issue