Skip to main content

CKAN 2.8 Pytest Plugin and Fixtures

This project backports the pytest environment for CKAN from CKAN 2.9 to CKAN 2.8. This allows CKAN extension developers to test CKAN plugins built to work with CKAN 2.8 as well as CKAN 2.9 or newer using a single unified test suite.

Installation & Usage

To use this in your project:

  • Add this library to your CKAN plugin project
  • Write your tests with pytest (you can use CKAN fixtures as described below)
  • Run pytest
  • When tested with CKAN 2.9 or newer, CKAN's built-in pytest plugin and fixtures will be used
  • When tested with older versions of CKAN, the code in pytest_ckan will be used instead

Adding to CKAN project

To use this plugin to test your CKAN extension, simply install this library to your development / testing environment:

pip install pytest-ckan

If you maintain a dev-requirements.txt or test-requirements.txt file you can add this library to it.

Running Pytest

To enable CKAN testing, simply add --ckan-ini=<path/to/test.ini> to your pytest command, for example:

pytest --ckan-ini=test.ini ckanext/yourextension/tests

Using CKAN Fixtures and Markers in Tests

TBD;

For now, see CKAN 2.9's extension testing guide for some examples.

License & Acknowledgement

This work is largely based on @wardi's work for ckanext-scheming. It has been extracted so it can be re-used by other CKAN extensions.

ckanext-scheming is copyright (c) Her Majesty the Queen in Right of Canada, represented by the President of the Treasury Board, 2013-2018

This plugin is free software districuted under the terms of the MIT License. See COPYING for details.

Copyright 2020 (c) Viderum Inc. / Datopian

Release files for pytest-ckan 0.0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-ckan 0.0.12
File Size Uploaded
pytest-ckan-0.0.12.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-ckan 0.0.12
File Interpreter ABI Platform
pytest_ckan-0.0.12-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.5 kB

Release files / pytest-ckan-0.0.12.tar.gz

Download URL pytest-ckan-0.0.12.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1e8a19d12aa500b3e58fd81ad12e7333bd5e950554f30bc84c45a50a46b94282
BLAKE2b-256 checksum
How to use checksums
73aaa434f31a61086a063e9b19fc9a922dda3d7d2b936fc007d07a3b567082d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/2.7.15

Release files / pytest_ckan-0.0.12-py2.py3-none-any.whl

Download URL pytest_ckan-0.0.12-py2.py3-none-any.whl
Size 6.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3c597cf8af6924c2825774ce31db741d6946e324fe8ae37d4a20e344daf49f62
BLAKE2b-256 checksum
How to use checksums
ee624b61c37ea4b72265878c6f8ed929d6363b5543c7f2742e809f75bbc3e64f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/2.7.15

Release history Release notifications | RSS feed

This release

0.0.12 This release

2 release files

0.0.11

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page