Creating an Installable Plugin

The process for sharing plugins with others is well-defined. Even if you never put your own plugin up on PyPI, by walking through the process, you’ll have an easier time reading the code from open source plugins and be better equipped to judge if they will help you or not.

It would be overkill to fully cover Python packaging and distribution in this book, as the topic is well documented elsewhere.[13][14] However, it’s a small task to go from the local config plugin we created in the previous section to something pip-installable.

First, we need to create a new directory to put our plugin code. It does not matter what you call it, but since we are making a plugin for the “nice” flag, let’s call it pytest-nice ...

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.