diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f9c2ab..9ec73d6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,16 +19,16 @@ jobs: needs: lint strategy: matrix: - ckan-version: ["2.10", 2.9, 2.9-py2, 2.8] + ckan-version: ["2.11", "2.10", 2.9] fail-fast: false name: CKAN ${{ matrix.ckan-version }} runs-on: ubuntu-latest container: - image: openknowledge/ckan-dev:${{ matrix.ckan-version }} + image: ckan/ckan-dev:${{ matrix.ckan-version }} services: solr: - image: ckan/ckan-solr:${{ matrix.ckan-version }} + image: ckan/ckan-solr:${{ matrix.ckan-version }}-solr9 postgres: image: ckan/ckan-postgres-dev:${{ matrix.ckan-version }} env: @@ -54,22 +54,16 @@ jobs: # Replace default path to CKAN core config file with the one on the container sed -i -e 's/use = config:.*/use = config:\/srv\/app\/src\/ckan\/test-core.ini/' test.ini - name: Setup extension (CKAN 2.10) - if: ${{ matrix.ckan-version == '2.10' }} + if: ${{ matrix.ckan-version >= '2.10' }} run: | pip install -r dev-requirements.txt ckan -c test.ini db init ckan -c test.ini db upgrade -p googleanalytics - name: Setup extension (CKAN == 2.9) - if: ${{ matrix.ckan-version == '2.9' || matrix.ckan-version == '2.9-py2' }} + if: ${{ matrix.ckan-version == '2.9' }} run: | pip install -r dev-requirements-2.9.txt ckan -c test.ini db init ckan -c test.ini db upgrade -p googleanalytics - - name: Setup extension (CKAN < 2.9) - if: ${{ matrix.ckan-version == '2.8' }} - run: | - pip install -r dev-requirements-2.9.txt - paster --plugin=ckan db init -c test.ini - paster --plugin=ckanext-googleanalytics initdb -c test.ini - name: Run tests run: pytest --ckan-ini=test.ini --cov=ckanext.googleanalytics --disable-warnings ckanext/googleanalytics/tests diff --git a/ckanext/googleanalytics/tests/test_plugin.py b/ckanext/googleanalytics/tests/test_plugin.py index 15682bf..0e38b2f 100644 --- a/ckanext/googleanalytics/tests/test_plugin.py +++ b/ckanext/googleanalytics/tests/test_plugin.py @@ -1,7 +1,7 @@ import pytest -@pytest.mark.usefixtures("clean_db") +@pytest.mark.usefixtures("with_plugins", "clean_db") def test_script(app): resp = app.get("/") assert "GoogleAnalyticsObject" in resp diff --git a/ckanext/googleanalytics/tests/test_view.py b/ckanext/googleanalytics/tests/test_view.py index 48787fb..03162df 100644 --- a/ckanext/googleanalytics/tests/test_view.py +++ b/ckanext/googleanalytics/tests/test_view.py @@ -1,5 +1,5 @@ import pytest - +import six import ckan.plugins.toolkit as tk from ckanext.googleanalytics import config @@ -23,4 +23,4 @@ class TestCodeSnippets: monkeypatch.setitem(ckan_config, config.CONFIG_TRACKING_MODE, mode) snippet = _render_header(mode, tracking_id) resp = app.get("/about") - assert snippet in resp.body + assert six.ensure_str(snippet) in resp diff --git a/setup.cfg b/setup.cfg index a0f964d..89c22a0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = ckanext-googleanalytics -version = 2.3.0 +version = 2.4.0 description = Add GA tracking and reporting to CKAN instance long_description = file: README.md long_description_content_type = text/markdown @@ -11,16 +11,17 @@ license = AGPL classifiers = Development Status :: 4 - Beta License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+) - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 keywords = CKAN [options] -# python_requires = >= 3.7 +python_requires = >= 3.7 install_requires = ckantoolkit google-api-python-client