Skip to content

Version detection fails on Ubuntu (Mint) installation #100

Closed
@mykmartin

Description

@mykmartin

On Linux Mint (an Ubuntu derivative), the version string produced by postgres isn't parsed correctly by get_pg_version() in utils.py:

$ /usr/lib/postgresql/15/bin/postgres --version
postgres (PostgreSQL) 15.5 (Ubuntu 15.5-1.pgdg22.04+1)

$ python ./tests/test_simple.py 
Traceback (most recent call last):
  File "testgres/env/lib/python3.10/site-packages/testgres/utils.py", line 31, in __init__
    super().__init__(version)
  File "testgres/env/lib/python3.10/site-packages/packaging/version.py", line 200, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '15.5-1.pgdg22.04+1)'

There appears to be a fairly simple fix in get_pg_version(), line 185:

    # Remove "(Homebrew)" and "(Ubuntu <version>)" if present
    raw_ver = raw_ver.replace('(Homebrew)', '').strip()
    raw_ver = re.sub('\(Ubuntu[^)]*\)', '', raw_ver).strip()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions