Debian Codegraph @

tests/roots/test-ext-doctest-skipif/skipif.txt

raw
1 Testing the doctest extension's `:skipif:` option
2 =================================================
3
4 testsetup
5 ---------
6
7 .. testsetup:: group-skipif
8 :skipif: record('testsetup', ':skipif:', True) != 'this will be True'
9
10 record('testsetup', 'body', True)
11
12 .. testsetup:: group-skipif
13 :skipif: record('testsetup', ':skipif:', False) == 'this will be False'
14
15 record('testsetup', 'body', False)
16
17
18 doctest
19 -------
20 .. doctest:: group-skipif
21 :skipif: record('doctest', ':skipif:', True) != 'this will be True'
22
23 >>> print(record('doctest', 'body', True))
24 The test is skipped, and this expected text is ignored
25
26
27 .. doctest::
28 :skipif: record('doctest', ':skipif:', False) == 'this will be False'
29
30 >>> print(record('doctest', 'body', False))
31 Recorded doctest body False
32
33
34 testcode and testoutput
35 -----------------------
36
37 testcode skipped
38 ~~~~~~~~~~~~~~~~
39
40 .. testcode:: group-skipif
41 :skipif: record('testcode', ':skipif:', True) != 'this will be True'
42
43 print(record('testcode', 'body', True))
44
45 .. testoutput:: group-skipif
46 :skipif: record('testoutput-1', ':skipif:', True) != 'this will be True'
47
48 The previous testcode is skipped, and the :skipif: condition is True,
49 so this testoutput is ignored
50
51 testcode executed
52 ~~~~~~~~~~~~~~~~~
53
54 .. testcode:: group-skipif
55 :skipif: record('testcode', ':skipif:', False) == 'this will be False'
56
57 print(record('testcode', 'body', False))
58
59 .. testoutput:: group-skipif
60 :skipif: record('testoutput-2', ':skipif:', False) == 'this will be False'
61
62 Recorded testcode body False
63
64 .. testoutput:: group-skipif
65 :skipif: record('testoutput-2', ':skipif:', True) != 'this will be True'
66
67 The :skipif: condition is False, so this testoutput is ignored
68
69
70 testcleanup
71 -----------
72
73 .. testcleanup:: group-skipif
74 :skipif: record('testcleanup', ':skipif:', True) != 'this will be True'
75
76 record('testcleanup', 'body', True)
77
78 .. testcleanup:: group-skipif
79 :skipif: record('testcleanup', ':skipif:', False) == 'this will be False'
80
81 record('testcleanup', 'body', False)