diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 80fe889..654f2db 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,33 +12,20 @@ jobs: strategy: fail-fast: false matrix: - python: ['3.7', '3.8', '3.9'] + python: ['3.8', '3.9', '3.10'] # Time to switch to pytest or nose2? # nosetests is broken on 3.10 # AttributeError: module 'collections' has no attribute 'Callable' # https://github.com/nose-devs/nose/issues/1099 django: - - 'Django~=3.2.0' - - 'Django~=4.0.0' - - 'Django~=4.1.0' - - 'Django~=4.2.0' + - 'Django~=3.2.0' + - 'Django~=4.0.0' + - 'Django~=4.1.0' + - 'Django~=4.2.0' + psycopg: + - 'psycopg2>2.9' + - 'psycopg>=3.1.8' experimental: [false] -# include: -# - python: '3.9' -# django: 'https://github.com/django/django/archive/refs/heads/main.zip#egg=Django' -# experimental: true - # NOTE this job will appear to pass even when it fails because of - # `continue-on-error: true`. Github Actions apparently does not - # have this feature, similar to Travis' allow-failure, yet. - # https://github.com/actions/toolkit/issues/399 - exclude: - - python: '3.7' - django: 'Django~=4.0.0' - - python: '3.7' - django: 'Django~=4.1.0' - - python: '3.7' - django: 'Django~=4.2.0' - services: postgres: image: postgres:latest @@ -65,6 +52,7 @@ jobs: pip install -r requirements/requirements.txt pip install -r requirements/requirements-testing.txt pip install "${{ matrix.django }}" + pip uninstall psycopg psycopg2 && pip install "${{ matrix.psycopg }}" pip freeze - name: Run tests env: diff --git a/ambition_utils/docs/release_notes.rst b/ambition_utils/docs/release_notes.rst index 060acf2..e4635e0 100644 --- a/ambition_utils/docs/release_notes.rst +++ b/ambition_utils/docs/release_notes.rst @@ -2,6 +2,10 @@ Release Notes ============= +3.2.0 +------ +* Add support for psycopg (psycopg3). Still supports psycopg2. + 3.1.11 ------ * migration adjustment diff --git a/ambition_utils/sql.py b/ambition_utils/sql.py index c11bdbe..c543e7a 100644 --- a/ambition_utils/sql.py +++ b/ambition_utils/sql.py @@ -75,7 +75,7 @@ def run(self): self._raw_results = list(cursor.fetchall()) self._raw_columns = [col[0] for col in cursor.description] except ProgrammingError as e: - if str(e) == 'no results to fetch': + if str(e) == 'no results to fetch' or str(e) == "the last operation didn't produce a result": self._raw_results = [] self._raw_columns = [] else: # pragma: no cover No expected to hit this, but raise just in case diff --git a/ambition_utils/version.py b/ambition_utils/version.py index f71ed60..573cf70 100644 --- a/ambition_utils/version.py +++ b/ambition_utils/version.py @@ -1 +1 @@ -__version__ = '3.1.11' +__version__ = '3.2.0' diff --git a/manage.py b/manage.py index b997ce1..61b7198 100644 --- a/manage.py +++ b/manage.py @@ -1,6 +1,10 @@ #!/usr/bin/env python import sys +# These lines allow nose tests to work in Python 3.10 +import collections.abc +collections.Callable = collections.abc.Callable + # Show warnings about django deprecations - uncomment for version upgrade testing import warnings from django.utils.deprecation import RemovedInNextVersionWarning