We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Deprecate use of other decorators without `@given`
This was first suggested in #1135 for `@settings()`, but the approach taken did not scale as each decorator would have to know about all of the others.  Fortunately, #2162 gave us a much nicer option: we can just check for other decorators in our pytest plugin, when we already know that `@given` was never applied!

That means adding a deprecation warning for each of `@example`, `@seed`, and `@reproduce_failure` based on the special attributes they attach to the test function.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `hypothesis-python/src/hypothesis/extra/pytestplugin.py`
Content:
```
1 # coding=utf-8
2 #
3 # This file is part of Hypothesis, which may be found at
4 # https://github.com/HypothesisWorks/hypothesis/
5 #
6 # Most of this work is copyright (C) 2013-2019 David R. MacIver
7 # (david@drmaciver.com), but it contains contributions by others. See
8 # CONTRIBUTING.rst for a full list of people who may hold copyright, and
9 # consult the git log if you need to determine who owns an individual
10 # contribution.
11 #
12 # This Source Code Form is subject to the terms of the Mozilla Public License,
13 # v. 2.0. If a copy of the MPL was not distributed with this file, You can
14 # obtain one at https://mozilla.org/MPL/2.0/.
15 #
16 # END HEADER
17 
18 from __future__ import absolute_import, division, print_function
19 
20 from distutils.version import LooseVersion
21 
22 import pytest
23 
24 from hypothesis import Verbosity, core, settings
25 from hypothesis._settings import note_deprecation
26 from hypothesis.errors import InvalidArgument
27 from hypothesis.internal.compat import text_type
28 from hypothesis.internal.detection import is_hypothesis_test
29 from hypothesis.reporting import default as default_reporter, with_reporter
30 from hypothesis.statistics import collector
31 
32 LOAD_PROFILE_OPTION = "--hypothesis-profile"
33 VERBOSITY_OPTION = "--hypothesis-verbosity"
34 PRINT_STATISTICS_OPTION = "--hypothesis-show-statistics"
35 SEED_OPTION = "--hypothesis-seed"
36 
37 
38 class StoringReporter(object):
39     def __init__(self, config):
40         self.config = config
41         self.results = []
42 
43     def __call__(self, msg):
44         if self.config.getoption("capture", "fd") == "no":
45             default_reporter(msg)
46         if not isinstance(msg, text_type):
47             msg = repr(msg)
48         self.results.append(msg)
49 
50 
51 if LooseVersion(pytest.__version__) < "4.3":  # pragma: no cover
52     import warnings
53     from hypothesis.errors import HypothesisWarning
54 
55     PYTEST_TOO_OLD_MESSAGE = """
56         You are using Pytest version %s.  Hypothesis tests work with any test
57         runner, but our Pytest plugin requires Pytest  4.3 or newer.
58         Note that the Pytest developers no longer support this version either!
59         Disabling the Hypothesis pytest plugin...
60     """
61     warnings.warn(PYTEST_TOO_OLD_MESSAGE % (pytest.__version__,), HypothesisWarning)
62 
63 else:
64 
65     def pytest_addoption(parser):
66         group = parser.getgroup("hypothesis", "Hypothesis")
67         group.addoption(
68             LOAD_PROFILE_OPTION,
69             action="store",
70             help="Load in a registered hypothesis.settings profile",
71         )
72         group.addoption(
73             VERBOSITY_OPTION,
74             action="store",
75             choices=[opt.name for opt in Verbosity],
76             help="Override profile with verbosity setting specified",
77         )
78         group.addoption(
79             PRINT_STATISTICS_OPTION,
80             action="store_true",
81             help="Configure when statistics are printed",
82             default=False,
83         )
84         group.addoption(
85             SEED_OPTION,
86             action="store",
87             help="Set a seed to use for all Hypothesis tests",
88         )
89 
90     def pytest_report_header(config):
91         profile = config.getoption(LOAD_PROFILE_OPTION)
92         if not profile:
93             profile = settings._current_profile
94         settings_str = settings.get_profile(profile).show_changed()
95         if settings_str != "":
96             settings_str = " -> %s" % (settings_str)
97         if (
98             config.option.verbose >= 1
99             or settings.default.verbosity >= Verbosity.verbose
100         ):
101             return "hypothesis profile %r%s" % (profile, settings_str)
102 
103     def pytest_configure(config):
104         core.running_under_pytest = True
105         profile = config.getoption(LOAD_PROFILE_OPTION)
106         if profile:
107             settings.load_profile(profile)
108         verbosity_name = config.getoption(VERBOSITY_OPTION)
109         if verbosity_name:
110             verbosity_value = Verbosity[verbosity_name]
111             profile_name = "%s-with-%s-verbosity" % (
112                 settings._current_profile,
113                 verbosity_name,
114             )
115             # register_profile creates a new profile, exactly like the current one,
116             # with the extra values given (in this case 'verbosity')
117             settings.register_profile(profile_name, verbosity=verbosity_value)
118             settings.load_profile(profile_name)
119         seed = config.getoption(SEED_OPTION)
120         if seed is not None:
121             try:
122                 seed = int(seed)
123             except ValueError:
124                 pass
125             core.global_force_seed = seed
126         config.addinivalue_line("markers", "hypothesis: Tests which use hypothesis.")
127 
128     @pytest.hookimpl(hookwrapper=True)
129     def pytest_runtest_call(item):
130         if not hasattr(item, "obj"):
131             yield
132         elif not is_hypothesis_test(item.obj):
133             # If @given was not applied, check whether other hypothesis
134             # decorators were applied, and raise an error if they were.
135             if getattr(item.obj, "_hypothesis_internal_settings_applied", False):
136                 raise InvalidArgument(
137                     "Using `@settings` on a test without `@given` is completely pointless."
138                 )
139             yield
140         else:
141             if item.get_closest_marker("parametrize") is not None:
142                 # Give every parametrized test invocation a unique database key
143                 key = item.nodeid.encode("utf-8")
144                 item.obj.hypothesis.inner_test._hypothesis_internal_add_digest = key
145 
146             store = StoringReporter(item.config)
147 
148             def note_statistics(stats):
149                 lines = [item.nodeid + ":", ""] + stats.get_description() + [""]
150                 item.hypothesis_statistics = lines
151 
152             with collector.with_value(note_statistics):
153                 with with_reporter(store):
154                     yield
155             if store.results:
156                 item.hypothesis_report_information = list(store.results)
157 
158     @pytest.hookimpl(hookwrapper=True)
159     def pytest_runtest_makereport(item, call):
160         report = (yield).get_result()
161         if hasattr(item, "hypothesis_report_information"):
162             report.sections.append(
163                 ("Hypothesis", "\n".join(item.hypothesis_report_information))
164             )
165         if hasattr(item, "hypothesis_statistics") and report.when == "teardown":
166             val = ("hypothesis-stats", item.hypothesis_statistics)
167             report.user_properties.append(val)
168 
169     def pytest_terminal_summary(terminalreporter):
170         if not terminalreporter.config.getoption(PRINT_STATISTICS_OPTION):
171             return
172         terminalreporter.section("Hypothesis Statistics")
173         # terminalreporter.stats is a dict, where the empty string appears to
174         # always be the key for a list of _pytest.reports.TestReport objects
175         # (where we stored the statistics data in pytest_runtest_makereport above)
176         for test_report in terminalreporter.stats.get("", []):
177             for name, lines in test_report.user_properties:
178                 if name == "hypothesis-stats" and test_report.when == "teardown":
179                     for li in lines:
180                         terminalreporter.write_line(li)
181 
182     def pytest_collection_modifyitems(items):
183         for item in items:
184             if not isinstance(item, pytest.Function):
185                 continue
186             if is_hypothesis_test(item.obj):
187                 item.add_marker("hypothesis")
188             if getattr(item.obj, "is_hypothesis_strategy_function", False):
189 
190                 def note_strategy_is_not_test(*args, **kwargs):
191                     note_deprecation(
192                         "%s is a function that returns a Hypothesis strategy, "
193                         "but pytest has collected it as a test function.  This "
194                         "is useless as the function body will never be executed.  "
195                         "To define a test function, use @given instead of "
196                         "@composite." % (item.nodeid,),
197                         since="2018-11-02",
198                     )
199 
200                 item.obj = note_strategy_is_not_test
201 
202 
203 def load():
204     """Required for `pluggy` to load a plugin from setuptools entrypoints."""
205
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/hypothesis-python/src/hypothesis/extra/pytestplugin.py b/hypothesis-python/src/hypothesis/extra/pytestplugin.py
--- a/hypothesis-python/src/hypothesis/extra/pytestplugin.py
+++ b/hypothesis-python/src/hypothesis/extra/pytestplugin.py
@@ -132,10 +132,24 @@
         elif not is_hypothesis_test(item.obj):
             # If @given was not applied, check whether other hypothesis
             # decorators were applied, and raise an error if they were.
+            message = "Using `@%s` on a test without `@given` is completely pointless."
             if getattr(item.obj, "_hypothesis_internal_settings_applied", False):
-                raise InvalidArgument(
-                    "Using `@settings` on a test without `@given` is completely pointless."
+                raise InvalidArgument(message % ("settings",))
+            if getattr(item.obj, "is_hypothesis_strategy_function", False):
+                note_deprecation(
+                    "%s is a function that returns a Hypothesis strategy, but pytest "
+                    "has collected it as a test function.  This is useless as the "
+                    "function body will never be executed.  To define a test "
+                    "function, use @given instead of @composite." % (item.nodeid,),
+                    since="2018-11-02",
                 )
+            for name, attribute in [
+                ("example", "hypothesis_explicit_examples"),
+                ("seed", "_hypothesis_internal_use_seed"),
+                ("reproduce_example", "_hypothesis_internal_use_reproduce_failure"),
+            ]:
+                if hasattr(item.obj, attribute):
+                    note_deprecation(message % (name,), since="RELEASEDAY")
             yield
         else:
             if item.get_closest_marker("parametrize") is not None:
@@ -181,23 +195,8 @@
 
     def pytest_collection_modifyitems(items):
         for item in items:
-            if not isinstance(item, pytest.Function):
-                continue
-            if is_hypothesis_test(item.obj):
+            if isinstance(item, pytest.Function) and is_hypothesis_test(item.obj):
                 item.add_marker("hypothesis")
-            if getattr(item.obj, "is_hypothesis_strategy_function", False):
-
-                def note_strategy_is_not_test(*args, **kwargs):
-                    note_deprecation(
-                        "%s is a function that returns a Hypothesis strategy, "
-                        "but pytest has collected it as a test function.  This "
-                        "is useless as the function body will never be executed.  "
-                        "To define a test function, use @given instead of "
-                        "@composite." % (item.nodeid,),
-                        since="2018-11-02",
-                    )
-
-                item.obj = note_strategy_is_not_test
 
 
 def load():

{"golden_diff": "diff --git a/hypothesis-python/src/hypothesis/extra/pytestplugin.py b/hypothesis-python/src/hypothesis/extra/pytestplugin.py\n--- a/hypothesis-python/src/hypothesis/extra/pytestplugin.py\n+++ b/hypothesis-python/src/hypothesis/extra/pytestplugin.py\n@@ -132,10 +132,24 @@\n         elif not is_hypothesis_test(item.obj):\n             # If @given was not applied, check whether other hypothesis\n             # decorators were applied, and raise an error if they were.\n+            message = \"Using `@%s` on a test without `@given` is completely pointless.\"\n             if getattr(item.obj, \"_hypothesis_internal_settings_applied\", False):\n-                raise InvalidArgument(\n-                    \"Using `@settings` on a test without `@given` is completely pointless.\"\n+                raise InvalidArgument(message % (\"settings\",))\n+            if getattr(item.obj, \"is_hypothesis_strategy_function\", False):\n+                note_deprecation(\n+                    \"%s is a function that returns a Hypothesis strategy, but pytest \"\n+                    \"has collected it as a test function.  This is useless as the \"\n+                    \"function body will never be executed.  To define a test \"\n+                    \"function, use @given instead of @composite.\" % (item.nodeid,),\n+                    since=\"2018-11-02\",\n                 )\n+            for name, attribute in [\n+                (\"example\", \"hypothesis_explicit_examples\"),\n+                (\"seed\", \"_hypothesis_internal_use_seed\"),\n+                (\"reproduce_example\", \"_hypothesis_internal_use_reproduce_failure\"),\n+            ]:\n+                if hasattr(item.obj, attribute):\n+                    note_deprecation(message % (name,), since=\"RELEASEDAY\")\n             yield\n         else:\n             if item.get_closest_marker(\"parametrize\") is not None:\n@@ -181,23 +195,8 @@\n \n     def pytest_collection_modifyitems(items):\n         for item in items:\n-            if not isinstance(item, pytest.Function):\n-                continue\n-            if is_hypothesis_test(item.obj):\n+            if isinstance(item, pytest.Function) and is_hypothesis_test(item.obj):\n                 item.add_marker(\"hypothesis\")\n-            if getattr(item.obj, \"is_hypothesis_strategy_function\", False):\n-\n-                def note_strategy_is_not_test(*args, **kwargs):\n-                    note_deprecation(\n-                        \"%s is a function that returns a Hypothesis strategy, \"\n-                        \"but pytest has collected it as a test function.  This \"\n-                        \"is useless as the function body will never be executed.  \"\n-                        \"To define a test function, use @given instead of \"\n-                        \"@composite.\" % (item.nodeid,),\n-                        since=\"2018-11-02\",\n-                    )\n-\n-                item.obj = note_strategy_is_not_test\n \n \n def load():\n", "issue": "Deprecate use of other decorators without `@given`\nThis was first suggested in #1135 for `@settings()`, but the approach taken did not scale as each decorator would have to know about all of the others.  Fortunately, #2162 gave us a much nicer option: we can just check for other decorators in our pytest plugin, when we already know that `@given` was never applied!\r\n\r\nThat means adding a deprecation warning for each of `@example`, `@seed`, and `@reproduce_failure` based on the special attributes they attach to the test function.\n", "before_files": [{"content": "# coding=utf-8\n#\n# This file is part of Hypothesis, which may be found at\n# https://github.com/HypothesisWorks/hypothesis/\n#\n# Most of this work is copyright (C) 2013-2019 David R. MacIver\n# (david@drmaciver.com), but it contains contributions by others. See\n# CONTRIBUTING.rst for a full list of people who may hold copyright, and\n# consult the git log if you need to determine who owns an individual\n# contribution.\n#\n# This Source Code Form is subject to the terms of the Mozilla Public License,\n# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n# obtain one at https://mozilla.org/MPL/2.0/.\n#\n# END HEADER\n\nfrom __future__ import absolute_import, division, print_function\n\nfrom distutils.version import LooseVersion\n\nimport pytest\n\nfrom hypothesis import Verbosity, core, settings\nfrom hypothesis._settings import note_deprecation\nfrom hypothesis.errors import InvalidArgument\nfrom hypothesis.internal.compat import text_type\nfrom hypothesis.internal.detection import is_hypothesis_test\nfrom hypothesis.reporting import default as default_reporter, with_reporter\nfrom hypothesis.statistics import collector\n\nLOAD_PROFILE_OPTION = \"--hypothesis-profile\"\nVERBOSITY_OPTION = \"--hypothesis-verbosity\"\nPRINT_STATISTICS_OPTION = \"--hypothesis-show-statistics\"\nSEED_OPTION = \"--hypothesis-seed\"\n\n\nclass StoringReporter(object):\n    def __init__(self, config):\n        self.config = config\n        self.results = []\n\n    def __call__(self, msg):\n        if self.config.getoption(\"capture\", \"fd\") == \"no\":\n            default_reporter(msg)\n        if not isinstance(msg, text_type):\n            msg = repr(msg)\n        self.results.append(msg)\n\n\nif LooseVersion(pytest.__version__) < \"4.3\":  # pragma: no cover\n    import warnings\n    from hypothesis.errors import HypothesisWarning\n\n    PYTEST_TOO_OLD_MESSAGE = \"\"\"\n        You are using Pytest version %s.  Hypothesis tests work with any test\n        runner, but our Pytest plugin requires Pytest  4.3 or newer.\n        Note that the Pytest developers no longer support this version either!\n        Disabling the Hypothesis pytest plugin...\n    \"\"\"\n    warnings.warn(PYTEST_TOO_OLD_MESSAGE % (pytest.__version__,), HypothesisWarning)\n\nelse:\n\n    def pytest_addoption(parser):\n        group = parser.getgroup(\"hypothesis\", \"Hypothesis\")\n        group.addoption(\n            LOAD_PROFILE_OPTION,\n            action=\"store\",\n            help=\"Load in a registered hypothesis.settings profile\",\n        )\n        group.addoption(\n            VERBOSITY_OPTION,\n            action=\"store\",\n            choices=[opt.name for opt in Verbosity],\n            help=\"Override profile with verbosity setting specified\",\n        )\n        group.addoption(\n            PRINT_STATISTICS_OPTION,\n            action=\"store_true\",\n            help=\"Configure when statistics are printed\",\n            default=False,\n        )\n        group.addoption(\n            SEED_OPTION,\n            action=\"store\",\n            help=\"Set a seed to use for all Hypothesis tests\",\n        )\n\n    def pytest_report_header(config):\n        profile = config.getoption(LOAD_PROFILE_OPTION)\n        if not profile:\n            profile = settings._current_profile\n        settings_str = settings.get_profile(profile).show_changed()\n        if settings_str != \"\":\n            settings_str = \" -> %s\" % (settings_str)\n        if (\n            config.option.verbose >= 1\n            or settings.default.verbosity >= Verbosity.verbose\n        ):\n            return \"hypothesis profile %r%s\" % (profile, settings_str)\n\n    def pytest_configure(config):\n        core.running_under_pytest = True\n        profile = config.getoption(LOAD_PROFILE_OPTION)\n        if profile:\n            settings.load_profile(profile)\n        verbosity_name = config.getoption(VERBOSITY_OPTION)\n        if verbosity_name:\n            verbosity_value = Verbosity[verbosity_name]\n            profile_name = \"%s-with-%s-verbosity\" % (\n                settings._current_profile,\n                verbosity_name,\n            )\n            # register_profile creates a new profile, exactly like the current one,\n            # with the extra values given (in this case 'verbosity')\n            settings.register_profile(profile_name, verbosity=verbosity_value)\n            settings.load_profile(profile_name)\n        seed = config.getoption(SEED_OPTION)\n        if seed is not None:\n            try:\n                seed = int(seed)\n            except ValueError:\n                pass\n            core.global_force_seed = seed\n        config.addinivalue_line(\"markers\", \"hypothesis: Tests which use hypothesis.\")\n\n    @pytest.hookimpl(hookwrapper=True)\n    def pytest_runtest_call(item):\n        if not hasattr(item, \"obj\"):\n            yield\n        elif not is_hypothesis_test(item.obj):\n            # If @given was not applied, check whether other hypothesis\n            # decorators were applied, and raise an error if they were.\n            if getattr(item.obj, \"_hypothesis_internal_settings_applied\", False):\n                raise InvalidArgument(\n                    \"Using `@settings` on a test without `@given` is completely pointless.\"\n                )\n            yield\n        else:\n            if item.get_closest_marker(\"parametrize\") is not None:\n                # Give every parametrized test invocation a unique database key\n                key = item.nodeid.encode(\"utf-8\")\n                item.obj.hypothesis.inner_test._hypothesis_internal_add_digest = key\n\n            store = StoringReporter(item.config)\n\n            def note_statistics(stats):\n                lines = [item.nodeid + \":\", \"\"] + stats.get_description() + [\"\"]\n                item.hypothesis_statistics = lines\n\n            with collector.with_value(note_statistics):\n                with with_reporter(store):\n                    yield\n            if store.results:\n                item.hypothesis_report_information = list(store.results)\n\n    @pytest.hookimpl(hookwrapper=True)\n    def pytest_runtest_makereport(item, call):\n        report = (yield).get_result()\n        if hasattr(item, \"hypothesis_report_information\"):\n            report.sections.append(\n                (\"Hypothesis\", \"\\n\".join(item.hypothesis_report_information))\n            )\n        if hasattr(item, \"hypothesis_statistics\") and report.when == \"teardown\":\n            val = (\"hypothesis-stats\", item.hypothesis_statistics)\n            report.user_properties.append(val)\n\n    def pytest_terminal_summary(terminalreporter):\n        if not terminalreporter.config.getoption(PRINT_STATISTICS_OPTION):\n            return\n        terminalreporter.section(\"Hypothesis Statistics\")\n        # terminalreporter.stats is a dict, where the empty string appears to\n        # always be the key for a list of _pytest.reports.TestReport objects\n        # (where we stored the statistics data in pytest_runtest_makereport above)\n        for test_report in terminalreporter.stats.get(\"\", []):\n            for name, lines in test_report.user_properties:\n                if name == \"hypothesis-stats\" and test_report.when == \"teardown\":\n                    for li in lines:\n                        terminalreporter.write_line(li)\n\n    def pytest_collection_modifyitems(items):\n        for item in items:\n            if not isinstance(item, pytest.Function):\n                continue\n            if is_hypothesis_test(item.obj):\n                item.add_marker(\"hypothesis\")\n            if getattr(item.obj, \"is_hypothesis_strategy_function\", False):\n\n                def note_strategy_is_not_test(*args, **kwargs):\n                    note_deprecation(\n                        \"%s is a function that returns a Hypothesis strategy, \"\n                        \"but pytest has collected it as a test function.  This \"\n                        \"is useless as the function body will never be executed.  \"\n                        \"To define a test function, use @given instead of \"\n                        \"@composite.\" % (item.nodeid,),\n                        since=\"2018-11-02\",\n                    )\n\n                item.obj = note_strategy_is_not_test\n\n\ndef load():\n    \"\"\"Required for `pluggy` to load a plugin from setuptools entrypoints.\"\"\"\n", "path": "hypothesis-python/src/hypothesis/extra/pytestplugin.py"}], "after_files": [{"content": "# coding=utf-8\n#\n# This file is part of Hypothesis, which may be found at\n# https://github.com/HypothesisWorks/hypothesis/\n#\n# Most of this work is copyright (C) 2013-2019 David R. MacIver\n# (david@drmaciver.com), but it contains contributions by others. See\n# CONTRIBUTING.rst for a full list of people who may hold copyright, and\n# consult the git log if you need to determine who owns an individual\n# contribution.\n#\n# This Source Code Form is subject to the terms of the Mozilla Public License,\n# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n# obtain one at https://mozilla.org/MPL/2.0/.\n#\n# END HEADER\n\nfrom __future__ import absolute_import, division, print_function\n\nfrom distutils.version import LooseVersion\n\nimport pytest\n\nfrom hypothesis import Verbosity, core, settings\nfrom hypothesis._settings import note_deprecation\nfrom hypothesis.errors import InvalidArgument\nfrom hypothesis.internal.compat import text_type\nfrom hypothesis.internal.detection import is_hypothesis_test\nfrom hypothesis.reporting import default as default_reporter, with_reporter\nfrom hypothesis.statistics import collector\n\nLOAD_PROFILE_OPTION = \"--hypothesis-profile\"\nVERBOSITY_OPTION = \"--hypothesis-verbosity\"\nPRINT_STATISTICS_OPTION = \"--hypothesis-show-statistics\"\nSEED_OPTION = \"--hypothesis-seed\"\n\n\nclass StoringReporter(object):\n    def __init__(self, config):\n        self.config = config\n        self.results = []\n\n    def __call__(self, msg):\n        if self.config.getoption(\"capture\", \"fd\") == \"no\":\n            default_reporter(msg)\n        if not isinstance(msg, text_type):\n            msg = repr(msg)\n        self.results.append(msg)\n\n\nif LooseVersion(pytest.__version__) < \"4.3\":  # pragma: no cover\n    import warnings\n    from hypothesis.errors import HypothesisWarning\n\n    PYTEST_TOO_OLD_MESSAGE = \"\"\"\n        You are using Pytest version %s.  Hypothesis tests work with any test\n        runner, but our Pytest plugin requires Pytest  4.3 or newer.\n        Note that the Pytest developers no longer support this version either!\n        Disabling the Hypothesis pytest plugin...\n    \"\"\"\n    warnings.warn(PYTEST_TOO_OLD_MESSAGE % (pytest.__version__,), HypothesisWarning)\n\nelse:\n\n    def pytest_addoption(parser):\n        group = parser.getgroup(\"hypothesis\", \"Hypothesis\")\n        group.addoption(\n            LOAD_PROFILE_OPTION,\n            action=\"store\",\n            help=\"Load in a registered hypothesis.settings profile\",\n        )\n        group.addoption(\n            VERBOSITY_OPTION,\n            action=\"store\",\n            choices=[opt.name for opt in Verbosity],\n            help=\"Override profile with verbosity setting specified\",\n        )\n        group.addoption(\n            PRINT_STATISTICS_OPTION,\n            action=\"store_true\",\n            help=\"Configure when statistics are printed\",\n            default=False,\n        )\n        group.addoption(\n            SEED_OPTION,\n            action=\"store\",\n            help=\"Set a seed to use for all Hypothesis tests\",\n        )\n\n    def pytest_report_header(config):\n        profile = config.getoption(LOAD_PROFILE_OPTION)\n        if not profile:\n            profile = settings._current_profile\n        settings_str = settings.get_profile(profile).show_changed()\n        if settings_str != \"\":\n            settings_str = \" -> %s\" % (settings_str)\n        if (\n            config.option.verbose >= 1\n            or settings.default.verbosity >= Verbosity.verbose\n        ):\n            return \"hypothesis profile %r%s\" % (profile, settings_str)\n\n    def pytest_configure(config):\n        core.running_under_pytest = True\n        profile = config.getoption(LOAD_PROFILE_OPTION)\n        if profile:\n            settings.load_profile(profile)\n        verbosity_name = config.getoption(VERBOSITY_OPTION)\n        if verbosity_name:\n            verbosity_value = Verbosity[verbosity_name]\n            profile_name = \"%s-with-%s-verbosity\" % (\n                settings._current_profile,\n                verbosity_name,\n            )\n            # register_profile creates a new profile, exactly like the current one,\n            # with the extra values given (in this case 'verbosity')\n            settings.register_profile(profile_name, verbosity=verbosity_value)\n            settings.load_profile(profile_name)\n        seed = config.getoption(SEED_OPTION)\n        if seed is not None:\n            try:\n                seed = int(seed)\n            except ValueError:\n                pass\n            core.global_force_seed = seed\n        config.addinivalue_line(\"markers\", \"hypothesis: Tests which use hypothesis.\")\n\n    @pytest.hookimpl(hookwrapper=True)\n    def pytest_runtest_call(item):\n        if not hasattr(item, \"obj\"):\n            yield\n        elif not is_hypothesis_test(item.obj):\n            # If @given was not applied, check whether other hypothesis\n            # decorators were applied, and raise an error if they were.\n            message = \"Using `@%s` on a test without `@given` is completely pointless.\"\n            if getattr(item.obj, \"_hypothesis_internal_settings_applied\", False):\n                raise InvalidArgument(message % (\"settings\",))\n            if getattr(item.obj, \"is_hypothesis_strategy_function\", False):\n                note_deprecation(\n                    \"%s is a function that returns a Hypothesis strategy, but pytest \"\n                    \"has collected it as a test function.  This is useless as the \"\n                    \"function body will never be executed.  To define a test \"\n                    \"function, use @given instead of @composite.\" % (item.nodeid,),\n                    since=\"2018-11-02\",\n                )\n            for name, attribute in [\n                (\"example\", \"hypothesis_explicit_examples\"),\n                (\"seed\", \"_hypothesis_internal_use_seed\"),\n                (\"reproduce_example\", \"_hypothesis_internal_use_reproduce_failure\"),\n            ]:\n                if hasattr(item.obj, attribute):\n                    note_deprecation(message % (name,), since=\"RELEASEDAY\")\n            yield\n        else:\n            if item.get_closest_marker(\"parametrize\") is not None:\n                # Give every parametrized test invocation a unique database key\n                key = item.nodeid.encode(\"utf-8\")\n                item.obj.hypothesis.inner_test._hypothesis_internal_add_digest = key\n\n            store = StoringReporter(item.config)\n\n            def note_statistics(stats):\n                lines = [item.nodeid + \":\", \"\"] + stats.get_description() + [\"\"]\n                item.hypothesis_statistics = lines\n\n            with collector.with_value(note_statistics):\n                with with_reporter(store):\n                    yield\n            if store.results:\n                item.hypothesis_report_information = list(store.results)\n\n    @pytest.hookimpl(hookwrapper=True)\n    def pytest_runtest_makereport(item, call):\n        report = (yield).get_result()\n        if hasattr(item, \"hypothesis_report_information\"):\n            report.sections.append(\n                (\"Hypothesis\", \"\\n\".join(item.hypothesis_report_information))\n            )\n        if hasattr(item, \"hypothesis_statistics\") and report.when == \"teardown\":\n            val = (\"hypothesis-stats\", item.hypothesis_statistics)\n            report.user_properties.append(val)\n\n    def pytest_terminal_summary(terminalreporter):\n        if not terminalreporter.config.getoption(PRINT_STATISTICS_OPTION):\n            return\n        terminalreporter.section(\"Hypothesis Statistics\")\n        # terminalreporter.stats is a dict, where the empty string appears to\n        # always be the key for a list of _pytest.reports.TestReport objects\n        # (where we stored the statistics data in pytest_runtest_makereport above)\n        for test_report in terminalreporter.stats.get(\"\", []):\n            for name, lines in test_report.user_properties:\n                if name == \"hypothesis-stats\" and test_report.when == \"teardown\":\n                    for li in lines:\n                        terminalreporter.write_line(li)\n\n    def pytest_collection_modifyitems(items):\n        for item in items:\n            if isinstance(item, pytest.Function) and is_hypothesis_test(item.obj):\n                item.add_marker(\"hypothesis\")\n\n\ndef load():\n    \"\"\"Required for `pluggy` to load a plugin from setuptools entrypoints.\"\"\"\n", "path": "hypothesis-python/src/hypothesis/extra/pytestplugin.py"}]}