Skip to Main Content
Python Testing with pytest
book

Python Testing with pytest

by Brian Okken
February 2022
Intermediate to advanced content levelIntermediate to advanced
274 pages
6h 28m
English
Pragmatic Bookshelf
Content preview from Python Testing with pytest

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Testing with pytest

Python Testing with pytest

Brian Okken

Publisher Resources

ISBN: 9781680509427Errata Page