diff options
-rw-r--r-- | setup.py | 4 | ||||
-rwxr-xr-x | tests/test_cancel.py | 2 |
2 files changed, 4 insertions, 2 deletions
@@ -417,10 +417,12 @@ class psycopg_build_ext(build_ext): pgversion = "7.4.0" verre = re.compile( - r"(\d+)\.(\d+)(?:(?:\.(\d+))|(devel|(alpha|beta|rc)\d+))") + r"(\d+)(?:\.(\d+))?(?:(?:\.(\d+))|(devel|(?:alpha|beta|rc)\d+))?") m = verre.match(pgversion) if m: pgmajor, pgminor, pgpatch = m.group(1, 2, 3) + if pgminor is None or not pgminor.isdigit(): + pgminor = 0 if pgpatch is None or not pgpatch.isdigit(): pgpatch = 0 pgmajor = int(pgmajor) diff --git a/tests/test_cancel.py b/tests/test_cancel.py index 3a94e5f..f267d99 100755 --- a/tests/test_cancel.py +++ b/tests/test_cancel.py @@ -92,7 +92,7 @@ class CancelTests(ConnectingTestCase): self.assertRaises(psycopg2.OperationalError, async_conn.cancel) extras.wait_select(async_conn) cur = async_conn.cursor() - cur.execute("select pg_sleep(10000)") + cur.execute("select pg_sleep(2)") self.assertTrue(async_conn.isexecuting()) async_conn.cancel() self.assertRaises(psycopg2.extensions.QueryCanceledError, |