pytest-REANA

image image image image image image image

pytest-REANA is a component of the REANA reusable and reproducible research data analysis platform. It provides pytest fixtures and test utilities.

Deprecated. Starting with this release, the fixtures and helpers previously shipped here live in the libraries that own them:

  • REANA-Commons-coupled and pure fixtures, plus make_mock_api_client, are exported from reana_commons.testing and auto-loaded via reana-commons[tests].

  • Database-coupled fixtures are exported from reana_db.testing and auto-loaded via reana-db[tests].

Existing imports from pytest_reana.fixtures and pytest_reana.test_utils continue to work but emit a DeprecationWarning. New projects should depend on reana-commons[tests] and/or reana-db[tests] instead of pytest-reana. The package will be archived once the deprecation cycle ends.

Features

  • pytest fixtures (now provided by reana-commons[tests] and reana-db[tests])

  • mocking OpenAPI client with request format validation

  • mocking Advanced Message Queuing Protocol consumers and producers

  • mocking Celery tasks

  • mocking file system workspace access

  • mocking database access

Usage

The detailed information on how to install and use REANA can be found in docs.reana.io.

API

Fixtures

Deprecated re-exports of REANA pytest fixtures.

The fixtures previously living in this module now live in reana_commons.testing (commons- and pure-helpers) and reana_db.testing (database-coupled helpers). Importing from pytest_reana.fixtures still works but is deprecated and will be removed in a future release.

Plugin

Deprecated pytest plugin for REANA.

This module is no longer registered as a pytest11 plugin. The fixtures it used to expose are now provided by reana_commons.testing.plugin and reana_db.testing.plugin, which are auto-loaded via their own pytest entry points when reana-commons[tests] or reana-db[tests] is installed.

The module is kept as an importable shim so that legacy code that does from pytest_reana.plugin import ... still resolves.

Changelog

0.9.2 (2023-11-30)

  • Changes CI to use the stable release of Python 3.12.

0.9.1 (2023-09-26)

  • Adds support for Python 3.12.

  • Changes apispec dependency version in order to be compatible with PyYAML v6.

  • Fixes container image fixtures to be Podman-compatible.

  • Fixes Kombu documentation linking.

0.9.0 (2022-12-13)

  • Adds fixture providing example of user secrets needed for Kerberos tests.

  • Adds support for Python 3.11.

  • Fixes location of Celery docs for ReadTheDocs pages.

  • Removes hard-dependency on black code formatter version.

0.8.1 (2022-01-05)

  • Adds support for Python 3.10.

0.8.0 (2021-11-22)

  • Adds nested Yadage workflow specification fixture.

  • Adds empty workflow workspaces for sample workflows by default.

  • Adds internal representation of a scatter-gather Snakemake workflow fixture.

  • Changes tmp_shared_volume_path fixture to be configurable through environment variable.

  • Changes fixtures to run with the full workspace path stored in the database.

  • Removes support for Python 2.

0.7.2 (2021-07-02)

  • Changes internal dependencies to remove click.

0.7.1 (2021-03-17)

  • Adds support for Python 3.9.

  • Fixes minor code warnings.

  • Fixes installation by upgrading REANA-DB version.

0.7.0 (2020-10-20)

  • Adds new __reana database schema for db fixture.

  • Fixes a problem related to duplicated database session.

  • Changes code formatting to respect black coding style.

  • Changes documentation to single-page layout.

0.6.0 (2019-12-19)

  • Adds fixtures for secrets store.

  • Centralises test requirements.

  • Adds Python 3.8 support.

0.5.0 (2019-04-16)

  • Makes workspace path configurable for the sample_workflow_workspace fixture through the path parameter.

  • Adds sample_serial_workflow_in_db fixture.

  • Exposes previously hidden sample_yadage_workflow_in_db fixture.

  • Adds missing database session close in session fixture.

  • Adds helpers to represent starting and requeueing job conditions, sample_condition_for_starting_queued_workflows and sample_condition_for_requeueing_workflows.

0.4.1 (2018-11-06)

  • Adds directory including sample workspace data.

0.4.0 (2018-11-06)

  • Initial public release.

Contributing

Bug reports, issues, feature requests, and other contributions are welcome. If you find a demonstrable problem that is caused by the REANA code, please:

  1. Search for already reported problems.

  2. Check if the issue has been fixed or is still reproducible on the latest master branch.

  3. Create an issue, ideally with a test case.

If you create a pull request fixing a bug or implementing a feature, you can run the tests to ensure that everything is operating correctly:

$ ./run-tests.sh

Each pull request should preserve or increase code coverage.

License

MIT License

Copyright (C) 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026 CERN.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction.

Authors

The list of contributors in alphabetical order: