Creating an Installable Plugin
In this section, we’ll walk through the process of going from local conftest plugin to installable plugin. Even if you never put your own plugins up on PyPI, it’s good to walk through the process at least once. The experience will help you when reading code from open source plugins, and you’ll be better equipped to judge if the plugins can help you or not.
First, we need to create a new directory for our plugin code. The name of the top-level directory doesn’t really matter. We’ll call it pytest_skip_slow:
| pytest_skip_slow |
| ├── examples |
| │ └── test_slow.py |
| └── pytest_skip_slow.py |
Here test_slow.py was moved into an examples directory. We’ll use it as-is later when automating tests for the plugin. Our conftest.py ...
Get Python Testing with pytest now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.