Debian Codegraph @

hypothesis-python/tests/pytest/test_doctest.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 pytest_plugins = "pytester"
12
13 func_with_doctest = """
14 def hi():
15 '''
16 >>> i = 5
17 >>> i-1
18 4
19 '''
20 """
21
22
23 def test_can_run_doctests(testdir):
24 script = testdir.makepyfile(func_with_doctest)
25 result = testdir.runpytest(script, "--doctest-modules")
26 assert result.ret == 0