Skip to content

Instantly share code, notes, and snippets.

@jaraco
Created March 4, 2018 17:00
Show Gist options
  • Save jaraco/e795a9a34594d202711aedf22c484af9 to your computer and use it in GitHub Desktop.
Save jaraco/e795a9a34594d202711aedf22c484af9 to your computer and use it in GitHub Desktop.
$ git diff
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 5ad94aba64..9851661d88 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -7,6 +7,7 @@ import doctest
import functools
import os
import sys
+import importlib
# NOTE: There are some additional tests relating to interaction with
@@ -435,7 +436,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 ...:20 (1 example)>]
The exact name depends on how test_doctest was invoked, so allow for
leading path components.
@@ -681,6 +682,13 @@ Note here that 'bin', 'oct', and 'hex' are functions; 'float.as_integer_ratio',
and 'int' is a type.
"""
+ 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment