Bump golang.org/x/crypto from 0.6.0 to 0.31.0 in /go/checkerlib #162
GitHub Actions / Test Results
failed
Dec 11, 2024 in 0s
1 fail, 2 skipped, 75 pass in 37s
78 tests 75 ✅ 37s ⏱️
1 suites 2 💤
1 files 1 ❌
Results for commit d514b57.
Annotations
Check warning on line 0 in tests.controller.test_main_loop.MainLoopTest
github-actions / Test Results
test_last_tick (tests.controller.test_main_loop.MainLoopTest) failed
.tox/py311/log/results.xml [took 0s]
Raw output
sqlite3.OperationalError: cannot commit - no transaction is active
self = <test_main_loop.MainLoopTest testMethod=test_last_tick>
sleep_mock = <MagicMock name='sleep' id='139941902854224'>
@patch('time.sleep')
def test_last_tick(self, sleep_mock):
with transaction_cursor(self.connection) as cursor:
cursor.execute('UPDATE scoring_gamecontrol SET start = datetime("now", "-1 day"), '
' end = datetime("now", "+3 minutes"), '
' current_tick=479')
controller.main_loop_step(self.connection, self.metrics, Lock(), False)
sleep_mock.assert_called_once_with(0)
with transaction_cursor(self.connection) as cursor:
cursor.execute('SELECT current_tick FROM scoring_gamecontrol')
new_tick = cursor.fetchone()[0]
self.assertEqual(new_tick, 480)
> with transaction_cursor(self.connection) as cursor:
tests/controller/test_main_loop.py:147:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.11/contextlib.py:144: in __exit__
next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
db_conn = <sqlite3.Connection object at 0x7f46c37032e0>, always_rollback = False
@contextmanager
def transaction_cursor(db_conn, always_rollback=False):
"""
Context Manager providing a cursor within a database transaction for any PEP 249-compliant database
connection (with support for transactions). The transaction will be committed after leaving the context
and rolled back when an exception occurs in the context.
Context Managers for the database are not specified by PEP 249 and implemented by some libraries (e.g.
psycopg2) in ways incompatible to each other.
Args:
db_conn: A PEP 249-compliant database connection.
always_rollback: Do never commit transactions, but always roll them back. Useful for testing the
required grants (at least with some databases).
"""
# A transaction BEGINs implicitly when the previous one has been finalized
cursor = db_conn.cursor()
if isinstance(cursor, sqlite3.Cursor):
if sqlite3.threadsafety < 2:
raise Exception('SQLite must be built with thread safety')
cursor = _SQLite3Cursor(cursor)
try:
yield cursor
except: # noqa
db_conn.rollback()
raise
if always_rollback:
db_conn.rollback()
else:
> db_conn.commit()
E sqlite3.OperationalError: cannot commit - no transaction is active
.tox/py311/lib/python3.11/site-packages/ctf_gameserver/lib/database.py:38: OperationalError
Loading