Skip to content

Commit

Permalink
i
Browse files Browse the repository at this point in the history
  • Loading branch information
tlocke committed Sep 14, 2024
1 parent 61ebe72 commit db9c82e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 3 additions & 2 deletions test/dbapi/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from os import environ

import pytest
import re

from test.utils import parse_server_version

import pg8000.dbapi

Expand Down Expand Up @@ -58,5 +59,5 @@ def pg_version(cursor):
cursor.execute("select current_setting('server_version')")
retval = cursor.fetchall()
version = retval[0][0]
major = re.match(r'\d+', version).group() # leading digits in 17.0, 17rc1
major = parse_server_version(version)
return int(major)
5 changes: 3 additions & 2 deletions test/native/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from os import environ

import pytest
import re

from test.utils import parse_server_version

import pg8000.native

Expand Down Expand Up @@ -46,5 +47,5 @@ def fin():
def pg_version(con):
retval = con.run("select current_setting('server_version')")
version = retval[0][0]
major = re.match(r'\d+', version).group() # leading digits in 17.0, 17rc1
major = parse_server_version(version)
return int(major)
5 changes: 5 additions & 0 deletions test/test_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from test.utils import parse_server_version


def test_parse_server_version():
assert parse_server_version("17rc1") == 17
6 changes: 6 additions & 0 deletions test/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import re


def parse_server_version(version):
major = re.match(r"\d+", version).group() # leading digits in 17.0, 17rc1
return int(major)

0 comments on commit db9c82e

Please sign in to comment.