Pytest Pythonpath Plugin

0.7.4 · maintenance · verified Thu Apr 16

pytest-pythonpath is a pytest plugin designed to extend the `PYTHONPATH` from `pytest.ini` configuration files or command-line arguments before tests run. It provides functionality to add arbitrary directories to `sys.path` for module discovery during test execution. This plugin reached version 0.7.4 in February 2022 and is now largely considered obsolete since `pytest` version 7.0.0 introduced equivalent built-in functionality.

Common errors

Warnings

Install

Quickstart

To configure `pytest-pythonpath`, create or modify your `pytest.ini` file. The `python_paths` option adds directories to the beginning of `sys.path`. The `site_dirs` option processes directories similar to `.pth` files, using `addsitedir`, though these paths might not be at the very front of `sys.path`. Paths are relative to the project's root directory.

[pytest]
python_paths = src my_project/libs
site_dirs = other_packages

view raw JSON →