Welcome to PatchIO’s documentation!¶
Contents:
PatchIO¶
Python monkey-patching utilities
- Free software: BSD license
- Documentation: https://patchio.readthedocs.org.
- Issue tracker: https://github.com/treyhunner/patchio/issues
- Package available on PyPI
Pull requests are welcome. Read the CONTRIBUTING file for tips on submitting a pull request.
Usage¶
To use PatchIO in a project:
import patchio
Command-Line Arguments¶
You can use patch_args
to monkey patch command-line arguments.
This utility can be used as a context manager:
import sys
with patch_args(["hello", "world"]) as args:
assert " ".join(sys.argv[1:]) == "hello world"
assert args == sys.argv
This utility can also be used as a decorator:
import sys
@patch_args(["hello", "world"])
def get_args():
return sys.argv
assert " ".join(get_args()) == "hello world"
Contributing¶
Below is a list of tips for submitting issues and pull requests. These are suggestions and not requirements.
Submitting Issues¶
Issues are often easier to reproduce/resolve when they have:
- A pull request with a failing test demonstrating the issue
- A code example that produces the issue consistently
- A traceback (when applicable)
Pull Requests¶
When creating a pull request, try to:
Testing¶
You will need tox and coverage installed to run the tests on your code:
$ pip install tox coverage
To run the tests and generate a coverage report (in htmlcov
directory):
$ make test-all
Please note: Before a pull request can be merged, all tests must pass and code/branch coverage in tests must be 100%.
Credits¶
Authors and contributors to patchio (listed alphabetically):
- Trey Hunner <trey@treyhunner.com>