Skip to content

Commit 221aa1a

Browse files
committed
Add stub pytestplugin
1 parent cfcf982 commit 221aa1a

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

hypothesis-python/.coveragerc

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ omit =
66
**/extra/cli.py
77
**/extra/django/*.py
88
**/extra/ghostwriter.py
9+
**/extra/pytestplugin.py
910
**/internal/scrutineer.py
1011
**/utils/terminal.py
1112

hypothesis-python/RELEASE.rst

-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ RELEASE_TYPE: minor
33
This release modifies our :pypi:`pytest` plugin, to avoid importing Hypothesis
44
and therefore triggering :ref:`Hypothesis' entry points <entry-points>` for
55
test suites where Hypothesis is installed but not actually used (:issue:`3140`).
6-
7-
If you :ref:`manually load the plugin <disabling-pytest-plugin>`, you'll need
8-
to update the module name accordingly.

hypothesis-python/docs/strategies.rst

+1-3
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ And that's all it takes!
189189
package to be installed.
190190

191191

192-
.. _disabling-pytest-plugin:
193-
194192
Interaction with :pypi:`pytest-cov`
195193
-----------------------------------
196194

@@ -204,5 +202,5 @@ opting out of the pytest plugin entirely. Alternatively, you can ensure that Hy
204202
is loaded after coverage measurement is started by disabling the entrypoint, and
205203
loading our pytest plugin from your ``conftest.py`` instead::
206204

207-
echo "pytest_plugins = ['_hypothesis_pytestplugin']\n" > tests/conftest.py
205+
echo "pytest_plugins = ['hypothesis.extra.pytestplugin']\n" > tests/conftest.py
208206
pytest -p "no:hypothesispytest" ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This file is part of Hypothesis, which may be found at
2+
# https://github.com/HypothesisWorks/hypothesis/
3+
#
4+
# Most of this work is copyright (C) 2013-2021 David R. MacIver
5+
# (david@drmaciver.com), but it contains contributions by others. See
6+
# CONTRIBUTING.rst for a full list of people who may hold copyright, and
7+
# consult the git log if you need to determine who owns an individual
8+
# contribution.
9+
#
10+
# This Source Code Form is subject to the terms of the Mozilla Public License,
11+
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
12+
# obtain one at https://mozilla.org/MPL/2.0/.
13+
#
14+
# END HEADER
15+
16+
"""
17+
Stub for users who manually load our pytest plugin.
18+
19+
The plugin implementation is now located in a top-level module outside the main
20+
hypothesis tree, so that Pytest can load the plugin without thereby triggering
21+
the import of Hypothesis itself (and thus loading our own plugins).
22+
"""
23+
24+
from _hypothesis_pytestplugin import * # noqa

0 commit comments

Comments
 (0)