Convert unittest test-cases to pytest
Project description
- Version:
- Version 0.1
- Copyright:
- Hartmut Goebel
- Licence:
GNU Public Licence v3 or later (GPLv3+)
- Homepage:
unittest2pytest is a tool that helps rewriting Python unittest test-cases into pytest test-cases.
In contrast to other similar tools, this unittest2pytest - handles keyword arguments, - handles single-line test-cases and several tests on one line, - uses context-handlers where appropriate.
This is done by using lib2to3 and Python’s mighty inspect module.
Installation
To install unittest2pytest, simply run:
pip install unittest2pytest
Usage
To print a diff of changes that unittest2pytest will make against a particular source file or directory:
unittest2pytest source_folder
To have those changes written to the files:
unittest2pytest -w source_folder
To have those changes written to another directory:
unittest2pytest -w source_folder --output-dir /some/where/else
By default, this will create backup files for each file that will be changed. You can add the -n option to not create the backups. Please do not do this if you are not using a version control system.
For more options about running particular fixers, run unittest2pytest --help or read the lib2to3 documentation. This tool is built on top of that one.
Fixes
A list of the available fixers can be found with the following:
$ unittest2pytest -l Available transformations for the -f/--fix option: remove_class self_assert
Changelog
v0.1 (2015-10-16)
Initial release
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
Hashes for unittest2pytest-0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92bd835b4ccb23a256004ce116e3a64820566a23d028812dd8bc375bbc0aab82 |
|
MD5 | a145c60da441725f700a04d2ddfc50c3 |
|
BLAKE2b-256 | 106e763e316513f27652528faae04e4ec1e9cfc423bab48a8055124ebc6a738c |