[issue2551241] psycopg2 doesn't have 'errors' in earlier versions, failing indexer tests on Debian buster

Ralf Schlatterbeck <[email protected]> Tue, 22 Nov 2022 15:35:24 +0000
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
New submission from Ralf Schlatterbeck:

I'm getting several failed tests with python3.7 and the then-current version of psycopg2. This fails most of the indexer tests in test/test_liveserver.py, e.g. 

test/test_liveserver.py:1305: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
roundup/instance.py:116: in open
    'db': backend.Database(self.config, name)
roundup/backends/rdbms_common.py:232: in __init__
    self.indexer = get_indexer(config, self)
roundup/backends/indexer_common.py:158: in get_indexer
    from roundup.backends.indexer_postgresql_fts import Indexer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    """
    
    import re
    
    from roundup.backends.indexer_common import Indexer as IndexerBase
    from roundup.i18n import _
    from roundup.cgi.exceptions import IndexerQueryError
    
>   from psycopg2.errors import InFailedSqlTransaction, SyntaxError, \
                                UndefinedObject
E                               ModuleNotFoundError: No module named 'psycopg2.errors'

roundup/backends/indexer_postgresql_fts.py:13: ModuleNotFoundError

Testing this on the command-line it looks like older psycopg2 modules do not have 'errors':

On Debian stable bullseye (version 11):
% python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from psycopg2 import errors
>>> 

On Debian oldstable buster (version 10):
% python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from psycopg2 import errors
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'errors' from 'psycopg2' (/usr/lib/python3/dist-packages/psycopg2/__init__.py)

----------
messages: 7664
nosy: schlatterbeck
severity: normal
status: new
title: psycopg2 doesn't have 'errors' in earlier versions, failing indexer tests on Debian buster

_________________________________________________
Roundup tracker <[email protected]>
<https://issues.roundup-tracker.org/issue2551241>
_________________________________________________