Skip to main content

A pytest plugin to run tests using unittest-style test IDs

Project description

pytest-unittest-id-runner

This project provides a simple pytest plugin that converts unittest-style test identifiers into pytest-style test identifiers when passed as file_or_dir arguments to pytest on the command line. This plug allows the following

pytest path.to.test_file.TestClass.test_method

to be used instead of

pytest path/to/test_file.py::TestClass::test_method

Installation

The plugin can be installed with:

pip install pytest-unittest-id-runner

Once installed, the plugin automatically attempts to perform the test identifier conversion without further configuration.

Motivation

This plugin fills a fairly specific niche. There are some projects out there that use unittest for testing instead of pytest, but they use unittest in a straightforward way, so that pytest can run the tests with its unittest compatibility support. When working on such a project, one may prefer to work with the tests locally using pytest. One motivation for doing this could be using a particular pytest feature or plugin for debugging test failures, since the pytest ecosystem is much bigger than unittest's. In this case, one will find that the tests are run in CI with unittest and the failures are printed in the unittest style. With pytest-unittest-id-runner installed, one can simply copy and paste the unittest identifiers from the CI output onto a pytest command line in order to debug the tests locally and not worry about converting between unittest and pytest styles of test identifier.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_unittest_id_runner-0.1.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_unittest_id_runner-0.1.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest_unittest_id_runner-0.1.1.tar.gz.

File metadata

File hashes

Hashes for pytest_unittest_id_runner-0.1.1.tar.gz
Algorithm Hash digest
SHA256 756b162e44b8a099110f963844e75604563909a59bdcf1f341e79415386ea2b3
MD5 67f39c49758eaf385a14cfc0038ccda4
BLAKE2b-256 291319627c7f2c660e77359e5edee62f7dce3ea9d94124dd93c75426b147d2e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_unittest_id_runner-0.1.1.tar.gz:

Publisher: python-publish.yml on wshanks/pytest-unittest-id-runner

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_unittest_id_runner-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_unittest_id_runner-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e8be2054e10487ddc0baef113067a80391b6503d4cdc0ced420c162198c5e5a
MD5 bc2e5cdae901c34a8a612f2e9e02a6b6
BLAKE2b-256 dae08645deac954bbe6adb08880020d2d0723b8d21f6519e3e9c576b22b15de3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_unittest_id_runner-0.1.1-py3-none-any.whl:

Publisher: python-publish.yml on wshanks/pytest-unittest-id-runner

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page