Skip to main content

Codemod to refactor unittest assertions to pytest assertions.

Project description

A codemod to automatically refactor unittest assertions with pytest assertions.

Installation

This codemod requires Python 3.8 or newer.

With pip, assuming Python 3.8 or newer is used:

python3 -m pip install codemod-unittest-to-pytest-asserts

With pipx, assuming Python 3.8 exists on the system:

pipx install --python $(which python3.8) codemod-unittest-to-pytest-asserts

Usage

Run the installed command on the Python files or directory of files you want to refactor:

codemod-unittest-to-pytest-asserts some-python-files.py

or:

codemod-unittest-to-pytest-asserts some_directory/

You’ll be asked to confirm all changes.

It is recommended to run an autoformatter, like Black, after the refactoring.

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

Built Distribution

File details

Details for the file codemod-unittest-to-pytest-asserts-1.0.4.tar.gz.

File metadata

  • Download URL: codemod-unittest-to-pytest-asserts-1.0.4.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for codemod-unittest-to-pytest-asserts-1.0.4.tar.gz
Algorithm Hash digest
SHA256 2bf5f0d894ae700650c3d62136857f63c9b5eda2ab056f7c5ccb40b52bbda5b4
MD5 b59f1d1ea4e8dfb5ba49ea7f12d3f3e5
BLAKE2b-256 3b3f7eee93eedef584429f8ec7f9bb2e4de2bc0ce8396eb29111f65ee03ff1e6

See more details on using hashes here.

File details

Details for the file codemod_unittest_to_pytest_asserts-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for codemod_unittest_to_pytest_asserts-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f9d781671acfb2ff5ab2237b71b2c5ae2193b8a0bbc02a287254820cd1578c0c
MD5 61f7e138983708ffa3e12e230e1b56ad
BLAKE2b-256 72b746a31a5d03545c66f9b558848b493038b63993c0785ec8b790f8c5989852

See more details on using hashes here.

Supported by

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