summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_doctest.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-06-22 20:24:45 (GMT)
committerGitHub <noreply@github.com>2022-06-22 20:24:45 (GMT)
commite52009d3f623c683aa22b4732fdf7fc2e55ede7c (patch)
tree9d61b42a12e2c4f1a628ce61f3cebc633dfa6363 /Lib/test/test_doctest.py
parentc1fb12e5afa09aca3134a9bc0116c31dbcccc5e9 (diff)
downloadcpython-e52009d3f623c683aa22b4732fdf7fc2e55ede7c.zip
cpython-e52009d3f623c683aa22b4732fdf7fc2e55ede7c.tar.gz
cpython-e52009d3f623c683aa22b4732fdf7fc2e55ede7c.tar.bz2
gh-84623: Move imports in doctests (#94133)
Move imports in doctests to prevent false alarms in pyflakes.
Diffstat (limited to 'Lib/test/test_doctest.py')
-rw-r--r--Lib/test/test_doctest.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index a4aab6c..7c79969 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -4,7 +4,6 @@ Test script for doctest.
from test import support
from test.support import import_helper
-from test.support import os_helper
import doctest
import functools
import os
@@ -14,7 +13,6 @@ import importlib.abc
import importlib.util
import unittest
import tempfile
-import shutil
import types
import contextlib
@@ -461,7 +459,7 @@ We'll simulate a __file__ attr that ends in pyc:
>>> tests = finder.find(sample_func)
>>> print(tests) # doctest: +ELLIPSIS
- [<DocTest sample_func from test_doctest.py:34 (1 example)>]
+ [<DocTest sample_func from test_doctest.py:32 (1 example)>]
The exact name depends on how test_doctest was invoked, so allow for
leading path components.
@@ -2811,6 +2809,8 @@ in it, and use a package hook to install a custom loader; on any platform,
at least one of the line endings will raise a ValueError for inconsistent
whitespace if doctest does not correctly do the newline conversion.
+ >>> from test.support import os_helper
+ >>> import shutil
>>> dn = tempfile.mkdtemp()
>>> pkg = os.path.join(dn, "doctest_testpkg")
>>> os.mkdir(pkg)