diff --git a/python-nitrate.spec b/python-nitrate.spec index 1b349f5..74708e6 100644 --- a/python-nitrate.spec +++ b/python-nitrate.spec @@ -78,9 +78,10 @@ Summary: %{summary} %{?python_provide:%python_provide python3-nitrate} %if %{with oldreqs} Requires: python%{python3_pkgversion}-gssapi -Requires: python%{python3_pkgversion}-psycopg2 +Requires: python%{python3_pkgversion}-psycopg3 Requires: python%{python3_pkgversion}-six %endif +Requires: libpq Conflicts: python2-nitrate < 1.5-3 %description -n python%{python3_pkgversion}-nitrate %_description diff --git a/setup.py b/setup.py index 2056f0a..b9d0c86 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ license='LGPLv2+', install_requires=[ 'gssapi', - 'psycopg2', + 'psycopg', 'six', ], url='https://psss.fedorapeople.org/python-nitrate/', diff --git a/source/containers.py b/source/containers.py index 93ab2b5..90202a1 100644 --- a/source/containers.py +++ b/source/containers.py @@ -58,7 +58,7 @@ """ import six -import psycopg2 +import psycopg from six.moves import xmlrpc_client as xmlrpclib @@ -842,7 +842,7 @@ def _fetch(self, inset=None): injects = self._teiid.run_cases(self.id) except teiid.TeiidNotConfigured: injects = self._server.TestRun.get_test_cases(self.id) - except psycopg2.DatabaseError as error: + except psycopg.DatabaseError as error: log.debug("Failed to fetch data from Teiid: {0}".format(error)) injects = self._server.TestRun.get_test_cases(self.id) self._current = set([TestCase(inject) for inject in injects]) @@ -915,7 +915,7 @@ def _fetch(self, inset=None): injects = self._teiid.run_case_runs(self.id) except teiid.TeiidNotConfigured: injects = self._server.TestRun.get_test_case_runs(self.id) - except psycopg2.DatabaseError as error: + except psycopg.DatabaseError as error: log.debug("Failed to fetch data from Teiid: {0}".format(error)) injects = self._server.TestRun.get_test_case_runs(self.id) # Feed the TestRun.testcases container with the initial object diff --git a/source/teiid.py b/source/teiid.py index a6046e5..9c6a826 100644 --- a/source/teiid.py +++ b/source/teiid.py @@ -22,7 +22,7 @@ Teiid support For enhanced query performance it's possible to use a Teiid instance. -Use the following config snippet to enable access via psycopg2 module: +Use the following config snippet to enable access via psycopg module: [teiid] user = username @@ -32,7 +32,7 @@ port = 5432 """ -import psycopg2 +import psycopg from nitrate.config import log, Config from nitrate.xmlrpc_driver import NitrateError @@ -74,9 +74,9 @@ def __init__(self): log.debug("Connecting as {0} to database {1} at {2}:{3}".format( user, database, host, port)) try: - self.connection = psycopg2.connect(database=database, + self.connection = psycopg.connect(database=database, user=user, password=password, host=host, port=port) - except psycopg2.DatabaseError as error: + except psycopg.DatabaseError as error: log.error("Teiid connect error: {0}".format(error)) raise TeiidError("Failed to connect to the Teiid instance") self.connection.set_isolation_level(0)