@@ -147,27 +147,33 @@ Making your plugin installable by others
147
147
148
148
If you want to make your plugin externally available, you
149
149
may define a so-called entry point for your distribution so
150
- that ``pytest `` finds your plugin module. Entry points are
151
- a feature that is provided by :std:doc: `setuptools:index `. pytest looks up
152
- the ``pytest11 `` entrypoint to discover its
153
- plugins and you can thus make your plugin available by defining
154
- it in your setuptools-invocation:
150
+ that ``pytest `` finds your plugin module. Entry points are
151
+ a feature that is provided by :std:doc: `setuptools <setuptools:index >`.
155
152
156
- .. sourcecode :: python
153
+ pytest looks up the ``pytest11 `` entrypoint to discover its
154
+ plugins, thus you can make your plugin available by defining
155
+ it in your ``pyproject.toml `` file.
156
+
157
+ .. sourcecode :: toml
158
+
159
+ # sample ./pyproject.toml file
160
+ [build-system]
161
+ requires = ["hatchling"]
162
+ build-backend = "hatchling.build"
157
163
158
- # sample ./setup.py file
159
- from setuptools import setup
164
+ [project]
165
+ name = "myproject"
166
+ classifiers = [
167
+ "Framework :: Pytest",
168
+ ]
160
169
170
+ [tool.setuptools]
171
+ packages = ["myproject"]
161
172
162
- name_of_plugin = "myproject" # register plugin with this name
163
- setup(
164
- name="myproject",
165
- packages=["myproject"],
166
- # the following makes a plugin available to pytest
167
- entry_points={"pytest11": [f"{name_of_plugin} = myproject.pluginmodule"]},
168
- # custom PyPI classifier for pytest plugins
169
- classifiers=["Framework :: Pytest"],
170
- )
173
+ [project.entry_points]
174
+ pytest11 = [
175
+ "myproject = myproject.pluginmodule",
176
+ ]
171
177
172
178
If a package is installed this way, ``pytest `` will load
173
179
``myproject.pluginmodule `` as a plugin which can define
0 commit comments