Skip to content

Commit 431f526

Browse files
[3.15] gh-111735: Skip turtle doctests when _tkinter is not available (GH-156417) (#156470)
Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 6f65cec commit 431f526

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

Doc/library/turtle.rst

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
**Source code:** :source:`Lib/turtle.py`
99

1010
.. testsetup:: default
11+
:skipif: _tkinter is None
1112

1213
from turtle import *
1314
turtle = Turtle()
1415

1516
.. testcleanup::
17+
:skipif: _tkinter is None
1618

1719
import os
1820
os.remove("my_drawing.ps")
@@ -510,6 +512,7 @@ Turtle motion
510512
turtle is headed. Do not change the turtle's heading.
511513

512514
.. doctest::
515+
:skipif: _tkinter is None
513516
:hide:
514517

515518
>>> turtle.goto(0, 0)
@@ -852,6 +855,7 @@ Turtle motion
852855
last *n* stamps.
853856

854857
.. doctest::
858+
:skipif: _tkinter is None
855859

856860
>>> for i in range(8):
857861
... unused_stamp_id = turtle.stamp()
@@ -1409,8 +1413,11 @@ More drawing control
14091413
font. If *move* is true, the pen is moved to the bottom-right corner of the
14101414
text. By default, *move* is ``False``.
14111415

1412-
>>> turtle.write("Home = ", True, align="center")
1413-
>>> turtle.write((0,0), True)
1416+
.. doctest::
1417+
:skipif: _tkinter is None
1418+
1419+
>>> turtle.write("Home = ", True, align="center")
1420+
>>> turtle.write((0,0), True)
14141421

14151422

14161423
Turtle state
@@ -1447,12 +1454,15 @@ Visibility
14471454

14481455
Return ``True`` if the Turtle is shown, ``False`` if it's hidden.
14491456

1450-
>>> turtle.hideturtle()
1451-
>>> turtle.isvisible()
1452-
False
1453-
>>> turtle.showturtle()
1454-
>>> turtle.isvisible()
1455-
True
1457+
.. doctest::
1458+
:skipif: _tkinter is None
1459+
1460+
>>> turtle.hideturtle()
1461+
>>> turtle.isvisible()
1462+
False
1463+
>>> turtle.showturtle()
1464+
>>> turtle.isvisible()
1465+
True
14561466

14571467

14581468
Appearance
@@ -1983,6 +1993,9 @@ Window control
19831993
method, one can make visible those parts of a drawing which were outside the
19841994
canvas before.
19851995

1996+
.. doctest::
1997+
:skipif: _tkinter is None
1998+
19861999
>>> screen.screensize()
19872000
(400, 300)
19882001
>>> screen.screensize(2000,1500)

0 commit comments

Comments
 (0)