Skip to content
Snippets Groups Projects
Commit 0a7e9007 authored by Dmitry Ivanov's avatar Dmitry Ivanov
Browse files

test(pgproto): check psql version (>= 15) in tab completion tests

parent a4da3161
No related branches found
No related tags found
1 merge request!1315Improve pgproto's tab completion tests
......@@ -2,12 +2,27 @@ import shutil
import sys
import pexpect # type: ignore
import pytest
import subprocess
import re
from conftest import Postgres
from packaging.version import Version # type: ignore
def test_tabcompletion(postgres: Postgres):
def psql_version() -> Version:
cmd = ["psql", "--version"]
output = subprocess.check_output(cmd).decode("utf-8")
raw_version = re.sub(r"\([^)]*\)", "", output).strip()
version = raw_version.rpartition(" ")[-1]
return Version(version)
def test_tab_completion(postgres: Postgres):
if not shutil.which("psql"):
pytest.skip("couldn't find psql")
pytest.skip("cannot find psql")
version = psql_version()
if version < Version("15"):
pytest.skip(f"unsupported psql {version}")
user = "postgres"
password = "Passw0rd"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment