Created
March 4, 2018 22:57
-
-
Save jaraco/ea992719ac931fa761a6e9ef7a354542 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py | |
| index 5ad94aba64..6b7479bb51 100644 | |
| --- a/Lib/test/test_doctest.py | |
| +++ b/Lib/test/test_doctest.py | |
| @@ -7,6 +7,8 @@ import doctest | |
| import functools | |
| import os | |
| import sys | |
| +import importlib | |
| +import unittest | |
| # NOTE: There are some additional tests relating to interaction with | |
| @@ -435,7 +437,7 @@ We'll simulate a __file__ attr that ends in pyc: | |
| >>> tests = finder.find(sample_func) | |
| >>> print(tests) # doctest: +ELLIPSIS | |
| - [<DocTest sample_func from ...:19 (1 example)>] | |
| + [<DocTest sample_func from ...:21 (1 example)>] | |
| The exact name depends on how test_doctest was invoked, so allow for | |
| leading path components. | |
| @@ -681,6 +683,16 @@ Note here that 'bin', 'oct', and 'hex' are functions; 'float.as_integer_ratio', | |
| and 'int' is a type. | |
| """ | |
| + | |
| +class TestDocTestFinder(unittest.TestCase): | |
| + | |
| + def test_empty_namespace_package(self): | |
| + pkg_name = 'doctest_empty_pkg' | |
| + os.mkdir(pkg_name) | |
| + mod = importlib.import_module(pkg_name) | |
| + assert doctest.DocTestFinder().find(mod) == [] | |
| + | |
| + | |
| def test_DocTestParser(): r""" | |
| Unit tests for the `DocTestParser` class. | |
| @@ -2945,6 +2957,10 @@ def test_main(): | |
| from test import test_doctest | |
| support.run_doctest(test_doctest, verbosity=True) | |
| + # Run unittests | |
| + support.run_unittest(__name__) | |
| + | |
| + | |
| def test_coverage(coverdir): | |
| trace = support.import_module('trace') | |
| tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment