skip test_fetchall_prevents_sqlite_misuse on travis
-print how many attempts the race condition took to trigger
This commit is contained in:
parent
02c51c6059
commit
abac82c1c6
1 changed files with 10 additions and 4 deletions
|
@ -1,7 +1,8 @@
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import tempfile
|
import tempfile
|
||||||
import os
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from concurrent.futures.thread import ThreadPoolExecutor
|
from concurrent.futures.thread import ThreadPoolExecutor
|
||||||
|
|
||||||
|
@ -478,6 +479,7 @@ class TestSQLiteRace(AsyncioTestCase):
|
||||||
async def test_unhandled_sqlite_misuse(self):
|
async def test_unhandled_sqlite_misuse(self):
|
||||||
# test SQLITE_MISUSE being incorrectly raised as a param 0 binding error
|
# test SQLITE_MISUSE being incorrectly raised as a param 0 binding error
|
||||||
attempts = 0
|
attempts = 0
|
||||||
|
python_version = sys.version.split('\n')[0].rstrip(' ')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while attempts < self.max_misuse_attempts:
|
while attempts < self.max_misuse_attempts:
|
||||||
|
@ -495,12 +497,16 @@ class TestSQLiteRace(AsyncioTestCase):
|
||||||
)
|
)
|
||||||
attempts += 1
|
attempts += 1
|
||||||
await asyncio.gather(f1, f2)
|
await asyncio.gather(f1, f2)
|
||||||
self.assertTrue(False, f'failed to raise SQLITE_MISUSE within {self.max_misuse_attempts} tries\n'
|
print(f"\nsqlite3 {sqlite3.version}/python {python_version} "
|
||||||
f'this test failing means either the sqlite race conditions '
|
f"did not raise SQLITE_MISUSE within {attempts} attempts of the race condition")
|
||||||
f'have been fixed in cpython or the test max_attempts needs to be increased')
|
self.assertTrue(False, 'this test failing means either the sqlite race conditions '
|
||||||
|
'have been fixed in cpython or the test max_attempts needs to be increased')
|
||||||
except sqlite3.InterfaceError as err:
|
except sqlite3.InterfaceError as err:
|
||||||
self.assertEqual(str(err), "Error binding parameter 0 - probably unsupported type.")
|
self.assertEqual(str(err), "Error binding parameter 0 - probably unsupported type.")
|
||||||
|
print(f"\nsqlite3 {sqlite3.version}/python {python_version} raised SQLITE_MISUSE "
|
||||||
|
f"after {attempts} attempts of the race condition")
|
||||||
|
|
||||||
|
@unittest.SkipTest
|
||||||
async def test_fetchall_prevents_sqlite_misuse(self):
|
async def test_fetchall_prevents_sqlite_misuse(self):
|
||||||
# test that calling fetchall sufficiently avoids the race
|
# test that calling fetchall sufficiently avoids the race
|
||||||
attempts = 0
|
attempts = 0
|
||||||
|
|
Loading…
Reference in a new issue