Debian Codegraph @

hypothesis-python/tests/pytest/test_checks.py

raw
1 # This file is part of Hypothesis, which may be found at
2 # https://github.com/HypothesisWorks/hypothesis/
3 #
4 # Copyright the Hypothesis Authors.
5 # Individual contributors are listed in AUTHORS.rst and the git log.
6 #
7 # This Source Code Form is subject to the terms of the Mozilla Public License,
8 # v. 2.0. If a copy of the MPL was not distributed with this file, You can
9 # obtain one at https://mozilla.org/MPL/2.0/.
10
11 TEST_DECORATORS_ALONE = """
12 import hypothesis
13 from hypothesis.strategies import composite, none
14
15 @composite
16 def test_composite_is_not_a_test(draw):
17 # This strategy will be instantiated, but no draws == no calls.
18 return draw(none())
19
20 @hypothesis.seed(0)
21 def test_seed_without_given_fails():
22 pass
23
24 @hypothesis.example(x=None)
25 def test_example_without_given_fails():
26 pass
27
28 @hypothesis.reproduce_failure(hypothesis.__version__, b"AA==")
29 def test_repro_without_given_fails():
30 pass
31 """
32
33
34 def test_decorators_without_given_should_fail(testdir):
35 script = testdir.makepyfile(TEST_DECORATORS_ALONE)
36 result = testdir.runpytest(script)
37 result.assert_outcomes(failed=4)
38 assert "pytest_runtest_call" not in "\n".join(result.outlines)