Skip to content

Commit

Permalink
fixes warning about sqlite3 conversion deprecation in python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfunley committed Jun 14, 2024
1 parent b5d204c commit 0f86ed7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/test_pugsql.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import pugsql
from pugsql import exceptions
import pytest
import threading
from unittest import TestCase

import pytest

import pugsql
from pugsql import exceptions


def test_module():
assert pugsql.module('tests/sql').sqlpaths == {'tests/sql',}
Expand Down Expand Up @@ -174,10 +176,16 @@ def test_pass_connect_args(self):
import sqlite3
from datetime import datetime

def _convert_timestamp(ts):
return datetime.strptime(ts.decode("utf-8"), "%Y-%m-%d %H:%M:%S")
sqlite3.register_converter('TIMESTAMP', _convert_timestamp)

self.fixtures.disconnect()
self.fixtures.connect(
'sqlite:///./tests/data/fixtures.sqlite3',
connect_args={'detect_types': sqlite3.PARSE_DECLTYPES})
connect_args={
'detect_types': sqlite3.PARSE_DECLTYPES,
})
date = self.fixtures.find_date(id=1)
self.assertIs(datetime, type(date['created']))

Expand Down

0 comments on commit 0f86ed7

Please sign in to comment.