Version detection fails on Ubuntu (Mint) installation
mykmartin opened this issue · 4 comments
mykmartin commented
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()
demonolock commented
Hi,
Thank you! The fix will be added to the next version 1.10.0
mykmartin commented
Great, thanks!
demonolock commented
The version 1.10.0 released, @mykmartin please check, is it work for you now?
mykmartin commented
It does! Thanks for the notification :)